Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date change doesn't happen at midnight (timezone?) #110

Closed
gorillica opened this issue Oct 13, 2021 · 5 comments
Closed

Date change doesn't happen at midnight (timezone?) #110

gorillica opened this issue Oct 13, 2021 · 5 comments

Comments

@gorillica
Copy link

Hi, I’m in Sydney, which is currently GMT+11 because of DST. I have a countdown set up using Anniversaries, but have noticed that the countdown doesn’t change until 11am here (midnight GMT). Everything else in Home Assistant shows the correct time zone (including Recorder entries). I can't see an obvious way to specify the time zone in the sensor configuration.

Is this fixable? Thanks! I wonder if it’s related to the issue being discussed at #106.

Screen Shot 2021-10-14 at 9 38 58 am

@pinkywafer
Copy link
Owner

pinkywafer commented Jan 4, 2022

Thanks. I believe this may be related, but I'll leave it as two separate issues for now.

Can you please try the 2022.01.04 release and let me know if that solves it? - For manual install, you only need the sensor.py from the timezone-fix-test branch.
To do hacs install, go to hacs and find the anniversaries integration. Click the menu (3 dots). Choose Redownload. Ensure Show beta versions is turned on and choose the 2022.01.04 release. You'll need to reboot Home Assistant

@pinkywafer
Copy link
Owner

unrelated issue.
so...
I'm going to take a guess that this is system specific - can you tell me about your install.
I've been able to replicate similar when having HA timezone different to OS timezone

@gorillica
Copy link
Author

gorillica commented Jan 5, 2022

I’m away from home for a couple of weeks, but when I get back I’ll try the timezone-fix-test branch. Then I’ll report back here: thanks!

I’m running HA Container in Docker, on an Ubuntu host system. I think I have the timezone set to my local TZ in the Docker environment, but I’d have to double-check all the specifics when I’m back.

@gorillica
Copy link
Author

I updated sensor.py to the version in the timezone-fix-test branch yesterday. When I went to check my sensor this morning, it hadn’t updated at midnight.

My Docker container has the right timezone: I have TZ="Australia/Sydney" as an environment variable in my Docker Compose file.

@pinkywafer
Copy link
Owner

Time zone is not configurable in the sensor, as it is not used for calculation. The date uses the Python date.today() function. This gets the date from the system without any timezone information. This is then compared with the configured date. The only way I have been able to get this to be off is for the system's and Home Assistant's time zones to be different to each other. However, a previous home assistant update made the time displayed in the graph use the browser's configured time zone, so check that the timezone on the device you're accessing the frontend is the same timezone and also check that the clock on that device is correct.
Also try the latest release as it is newer than the branch

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

No branches or pull requests

2 participants