hass.tibber_prices/custom_components/tibber_prices/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
..
attributes feat(sensors): expose energy/tax breakdown as sensor attributes 2026-04-09 18:27:36 +00:00
calculators feat(sensors): expose energy/tax breakdown as sensor attributes 2026-04-09 18:27:36 +00:00
__init__.py refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
chart_data.py feat(sensors): add chart_metadata sensor for lightweight chart configuration 2025-12-05 20:30:54 +00:00
chart_metadata.py fix: support main and subunit currency 2025-12-11 23:07:06 +00:00
core.py perf(sensors): add call-avoidance for timer-based state updates 2026-04-09 19:04:04 +00:00
definitions.py feat(sensors)!: rename price_trend_Xh → price_outlook_Xh, add price_trajectory_Xh 2026-04-09 16:08:42 +00:00
helpers.py refactor(sensor): replace redundant pass-through lambdas with direct references 2026-04-06 14:28:51 +00:00
types.py feat(types): add TypedDict documentation and BaseCalculator helpers 2025-11-22 14:32:24 +00:00
value_getters.py feat(sensors)!: rename price_trend_Xh → price_outlook_Xh, add price_trajectory_Xh 2026-04-09 16:08:42 +00:00