Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Times are incorrect by 1 hour #118

Open
antamy opened this issue Jan 26, 2022 · 4 comments
Open

Times are incorrect by 1 hour #118

antamy opened this issue Jan 26, 2022 · 4 comments

Comments

@antamy
Copy link

antamy commented Jan 26, 2022

I am on EST and have confirmed that my operating system date and time is correct and in the correct time zone (EST). In Home Assistant configuration.yaml, I also have the correct time zone specified.

When I look at sun.sun in Developer Tools, I see:

next_dawn: 2022-01-26T11:49:05.209042+00:00
next_dusk: 2022-01-26T23:32:27.668985+00:00
next_midnight: 2022-01-26T05:40:39+00:00
next_noon: 2022-01-26T17:40:29+00:00
next_rising: 2022-01-26T12:13:44.614876+00:00
next_setting: 2022-01-26T23:07:48.178739+00:00
elevation: -26.91
azimuth: 260.96
rising: false
friendly_name: Sun

Since I am on EST, 5 hours behind UTC, I'd expect sun-card to show 7:13am and 6:07pm respectively for the next sunrise / sunset. Instead, I see:

image

All the times are 6 hours behind the UTC times, as if daylight savings time is in effect. With some other code using a value_template of {{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom(' %I:%M %p') | replace(" 0", "") }}, I get the correct results:

image

@antamy
Copy link
Author

antamy commented Feb 16, 2022

Follow up to this. The problem is because the card displays the times in the timezone of the user, not the timezone of the home assistant installation. So in my case, the installation is on EST and I am viewing on a system set to CST. Which has the consequence of displaying the incorrect times for these events.

@jandirk39
Copy link

Hi,

I'm having the same issue. Is there already a fix for this?

@antamy
Copy link
Author

antamy commented Dec 6, 2022

Hi,

I'm having the same issue. Is there already a fix for this?

See my comment above. This is just how HA works. There was apparently no thought that people would want to use a system in a different time zone, so instead of localizing the UI to pick up the user's current time zone, it just uses the system's time zone. I worked around this by adding code to take care of it myself.

@jandirk39
Copy link

Thanks for the reply. I use HA now for two weeks so I’m still a noob. Used domoticz before. Where do I put the code?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants