Skip to content

v2.0.7

Latest

Choose a tag to compare

@sfox38 sfox38 released this 20 Jun 09:52
dc59876

v2.0.7

  • [Fix] "When timer expires" automation trigger didn't work - if you built an automation using the "Time Off: When timer expires" trigger, the automation could fail to load and then stay disabled, so it never ran. It now works as expected.
  • [Refactor] Coordinator architecture - the timer logic, persistence, startup recovery, and device-state handling moved out of the nested closures in __init__.py into a dedicated TimeOffCoordinator class in coordinator.py. Each piece is now an ordinary method (independently testable) instead of a closure whose reference was passed back through hass.data. No change to entities, services, events, or behavior.
  • [Performance] Event-driven countdown - the timer no longer wakes once per second to check the clock. It schedules a single async_track_point_in_time callback that fires exactly at expiry, and reuses the managed device's existing state listener to stop cleanly when it is turned off. This removes up to ~86,400 wake-ups per long-running timer and reduces the countdown to a single storage write per arm.
  • [Refactor] Single source of truth for Off After - the active duration now lives on the coordinator and the Off After sensor renders from it, replacing the previous dual store (a private field plus a parallel hass.data dict) that existed only to dodge stale state writes.
  • [Improvement] Internal updates moved to the dispatcher - the internal time_off_cache_updated bus event was replaced with Home Assistant's per-device dispatcher signal, so "timer changed, refresh" notifications no longer touch the global event bus or recorder. The public time_off_timer_expired event is unchanged.
  • [Improvement] hass.data namespacing - per-entry coordinators now live under hass.data["time_off"]["coordinators"], separated from the shared globals, removing the type-sniffing the old flat layout required to locate an entry.
  • [Improvement] Type hints and async_ naming - added throughout the integration and entity platforms for consistency with the Home Assistant style guide.
  • [Internal] manifest.json keys sorted into hassfest's required order (values unchanged).
  • [Doc] - Added mesa_profile.json