hass.tibber_prices/custom_components/tibber_prices/binary_sensor
Julian Pawlowski 459d6762c7 perf(sensors): add call-avoidance for timer-based state updates
Skip expensive async_write_ha_state() when native_value hasn't changed
since last write. HA's state machine has built-in change detection, but
it only runs AFTER all properties and attributes are evaluated — the
expensive part we now avoid entirely.

Sensor platform (Timer #2 + #3):
- New _write_if_changed() method compares native_value before writing
- Timer #3 (30s, 7 entities): Skips all writes when no period active
- Timer #2 (15min, ~45 entities): Skips enum levels/ratings that stay
  constant across quarter-hour intervals
- Replaces data_lifecycle_status-only pattern with unified approach

Binary sensor platform (Timer #2):
- Period sensors only write at actual period boundaries, not every 15min

Coordinator push updates always write (sentinel reset ensures freshness).

Impact: Eliminates asyncio "Executing TimerHandle took 1.4s" warnings
caused by redundant property evaluation in Timer #3 callbacks. Reduces
event loop blocking from ~1.4s to microseconds when values unchanged.
2026-04-09 19:04:04 +00:00
..
__init__.py fix(imports): update imports after utils package reorganization 2025-11-18 20:07:28 +00:00
attributes.py feat(binary_sensor): expose period calculation diagnostics as attributes 2026-04-06 12:18:48 +00:00
core.py perf(sensors): add call-avoidance for timer-based state updates 2026-04-09 19:04:04 +00:00
definitions.py refactor(entities): remove redundant name= from all entity descriptions 2026-04-06 13:16:07 +00:00
types.py refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00