mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-30 13:23:41 +00:00
Add comprehensive data_lifecycle_status sensor showing real-time cache vs fresh API data status with 6 states and 13+ detailed attributes. Key features: - 6 lifecycle states: cached, fresh, refreshing, searching_tomorrow, turnover_pending, error - Push-update system for instant state changes (refreshing→fresh→error) - Quarter-hour polling for turnover_pending detection at 23:45 - Accurate next_api_poll prediction using Timer #1 offset tracking - Tomorrow prediction with actual timer schedule (not fixed 13:00) - 13+ formatted attributes: cache_age, data_completeness, api_calls_today, next_api_poll, etc. Implementation: - sensor/calculators/lifecycle.py: New calculator with state logic - sensor/attributes/lifecycle.py: Attribute builders with formatting - coordinator/core.py: Lifecycle tracking + callback system (+16 lines) - sensor/core.py: Push callback registration (+3 lines) - coordinator/constants.py: Added to TIME_SENSITIVE_ENTITY_KEYS - Translations: All 5 languages (de, en, nb, nl, sv) Timing optimization: - Extended turnover warning: 5min → 15min (catches 23:45 quarter boundary) - No minute-timer needed: quarter-hour updates + push = optimal - Push-updates: <1sec latency for refreshing/fresh/error states - Timer offset tracking: Accurate tomorrow predictions Removed obsolete sensors: - data_timestamp (replaced by lifecycle attributes) - price_forecast (never implemented, removed from definitions) Impact: Users can monitor data freshness, API call patterns, cache age, and understand integration behavior. Perfect for troubleshooting and visibility into when data updates occur. |
||
|---|---|---|
| .. | ||
| api | ||
| binary_sensor | ||
| config_flow_handlers | ||
| coordinator | ||
| custom_translations | ||
| entity_utils | ||
| sensor | ||
| services | ||
| translations | ||
| utils | ||
| __init__.py | ||
| config_flow.py | ||
| const.py | ||
| data.py | ||
| diagnostics.py | ||
| entity.py | ||
| manifest.json | ||
| services.yaml | ||