mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-05-28 18:43:40 +00:00
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. |
||
|---|---|---|
| .. | ||
| api | ||
| binary_sensor | ||
| brand | ||
| config_flow_handlers | ||
| coordinator | ||
| custom_translations | ||
| entity_utils | ||
| interval_pool | ||
| number | ||
| sensor | ||
| services | ||
| switch | ||
| translations | ||
| utils | ||
| __init__.py | ||
| config_flow.py | ||
| const.py | ||
| data.py | ||
| diagnostics.py | ||
| entity.py | ||
| icons.json | ||
| manifest.json | ||
| services.yaml | ||