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

Don't set next_run when a zone is suspended #130

Merged
merged 1 commit into from
Mar 2, 2024
Merged

Don't set next_run when a zone is suspended #130

merged 1 commit into from
Mar 2, 2024

Conversation

dknowles2
Copy link
Owner

This is one of the problems with home-assistant/core#110054

If a zone is suspended, the time attribute returned is a constant of 50 years. This means that every time we refreshed the data, we got a moving value for the next run based on the delta from the current time at data refresh.

Instead of doing this, we just set next_run to None to indicate that we don't know when the next run will occur.

To fix a similar issue, we also clear out the microsecond value of the now datetime to make sure we don't drift slightly since the API only returns second-precision times.

Lastly, since we don't know the absolute time at which the suspension will end, we instead just set suspended_until to datetime.max, which also prevents date drifts from happening.

@dknowles2 dknowles2 added the bug Something isn't working label Mar 2, 2024
@dknowles2 dknowles2 merged commit 2c761df into main Mar 2, 2024
2 of 3 checks passed
@dknowles2 dknowles2 deleted the suspended branch December 1, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant