mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-30 05:13:40 +00:00
When adding a new integration (no existing cache), metadata sensors (grid_company, estimated_annual_consumption, etc.) were marked as unavailable because coordinator._cached_user_data remained None even after successful API call. Root cause: update_user_data_if_needed() stored user data in _data_fetcher.cached_user_data, but the sync back to coordinator only happened during _load_cache() (before the API call). Solution: Added explicit sync of cached_user_data after handle_main_entry_update() completes, ensuring metadata is available when sensors first access get_user_homes(). Changes: - coordinator/core.py: Sync _cached_user_data after main entry update - __init__.py: Kept preload cache call (helps with HA restarts) Impact: Metadata sensors now show values immediately on fresh integration setup, without requiring a second update cycle or manual sensor activation. |
||
|---|---|---|
| .. | ||
| 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 | ||