danobot / entity-controller

Home Assistant Entity and lighting controller for managing devices with timers, scripts, and sun-based time restrictions.
https://danobot.github.io/ec-docs/
GNU General Public License v3.0
289 stars 41 forks source link

Warn users that timezones are mismatched #311

Closed Tabisch closed 4 months ago

Tabisch commented 8 months ago

Description

I would like to introduce a feature to warn users, that their system timezone and home assistant timezone are mismatched. Because this integration uses both pythons datetime and homeassistant.util.dt, there might be some weird behavior in case of a mismatch.

For me this caused start_time_callback to get called repeatedly until i ran out of ram and the entire system locked up. After setting system timezone the issue went away.

The mismatch can happen easily in docker installtions, when TZ is not set, which defaults the system timezone to UTC. This is really hard to troubleshoot, because there is no indication, that this might be the root cause of the weird behavior.

Reference there i discovered, that this might be the root cause: https://community.home-assistant.io/t/event-async-track-point-in-time-problems-when-dst-is-active-was-alert-broken-in-0-42/14450/3 Its a few years old but still seams to be relevant.

(I already have a PR ready. This is only for completeness sake)