bart56
March 14, 2023, 5:34pm
1
I have a times of day sensor in my helpers set at 4 AM and 9 PM. When Daylight savings time occurred on March 12, the actions depending on the TOD sensor trigger at 5 AM and 10 PM. I went to edit the helper and set it to 4 AM and 9 PM again but it was still set correctly. I waited a day to see if it would correct itself, but it did not.
So I changed the times and updated, then I changed them back to 4AM and 9PM again and updated.
But the timer still triggers at 5AM and 10 PM.
Can someone tell me if this is a bug or by design (silly)? My system time and time display both show the correct time. How do I fix this?
Thanks.
WallyR
(Wally)
March 15, 2023, 2:48am
2
This is probably an issue with the time of the daylight time start.
It does not start the same time everywhere and here where I live it will be 10 days more before the it starts.
This is normally a localization setting, so what language are you using in HA and where in the world?
omayhemo
(Doug)
March 15, 2023, 12:03pm
3
I have the same problem. The TOD sensors are not updated for DST. I’m in CDT US. English, not that language should have any impact on DST IMO. How do I fix this without changing the TOD sensors manually to -1 the actual?
TazUk
(Taz Uk)
March 15, 2023, 12:53pm
4
home-assistant:dev
← jmwhite5:tod-bug-fix-48460
opened 08:42PM - 31 Dec 22 UTC
Fixes issues 48460 and 81382
<!--
You are amazing! Thanks for contributing… to our project!
Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
-->
## Proposed change
<!--
The TOD components doesn't handle Daylight Savings Time correctly. This change is a partial fix that improves **most** DST related scenarios (jump forward/backward).
**Outstanding issue:** The one outstanding issue left is related to the jump forward scenario (one day only) where the time involved falls into the non-existent local time (the time jumped over). The previous code did not handle this scenario and the test case just assume that the sensor would run into the following hour (e.g. if time is set for 2:30am (doesn't exist), then let it run until 3:30am). Ideally, the sensor should end (or start) in the next available time value that exists (e.g. 3am when time jumps from 2am to 3am). But this logic seems harder to implement without `pytz.exceptions.NonExistentTimeError`. This seems like another project 😀
-->
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [ ] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
https://github.com/home-assistant/core/issues/48460
https://github.com/home-assistant/core/issues/81382
-->
- This PR fixes or closes issue: Fixes #48460
- This PR fixes or closes issue: Fixes #81382
- This PR is related to issue:
- Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/29042
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [x] The code change is tested and works locally.
- [x] Local tests pass. **Your PR cannot be merged unless tests pass**
- [x] There is no commented out code in this PR.
- [x] I have followed the [development checklist][dev-checklist]
- [x] The code has been formatted using Black (`black --fast homeassistant tests`)
- [x] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io
Currently after a Daylight Savings time change homeassistant needs to be restarted for time of day sensors to be accurate.
bart56
March 16, 2023, 5:53pm
5
Thanks TazUK.
I restarted the system yesterday and sure enough, today the timers are again correct. I’ll have to update soon to the latest version to get the real fix.
Cheers,
Bart
TazUk
(Taz Uk)
March 16, 2023, 6:04pm
6
I believe the fix is still outstanding at the moment - the pull request will change status when completed.
bart56
March 18, 2023, 8:02pm
7
Thanks TazUk - much appreciated. It’s working great since I restarted HA so I’m in no hurry to update.
Cheers
2 Likes