hass.tibber_prices/custom_components/tibber_prices
Julian Pawlowski 87f0022baa fix(api): handle None values in API responses to prevent AttributeError
Fixed issue #60 where Tibber API temporarily returning incomplete data
(None values during maintenance) caused AttributeError crashes.

Root cause: `.get(key, default)` returns None when key exists with None value,
causing chained `.get()` calls to crash (None.get() → AttributeError).

Changes:
- api/helpers.py: Use `or {}` pattern in flatten_price_info() to handle
  None values (priceInfo, priceInfoRange, today, tomorrow)
- entity.py: Use `or {}` pattern in _get_fallback_device_info() for address dict
- coordinator/data_fetching.py: Add _validate_user_data() method (67 lines)
  to reject incomplete API responses before caching
- coordinator/data_fetching.py: Modify _get_currency_for_home() to raise
  exceptions instead of silent EUR fallback
- coordinator/data_fetching.py: Add home_id parameter to constructor
- coordinator/core.py: Pass home_id to TibberPricesDataFetcher
- tests/test_user_data_validation.py: Add 12 test cases for validation logic

Architecture improvement: Instead of defensive coding with fallbacks,
implement validation to reject incomplete data upfront. This prevents
caching temporary API errors and ensures currency is always known
(critical for price calculations).

Impact: Integration now handles API maintenance periods gracefully without
crashes. No silent EUR fallbacks - raises exceptions if currency unavailable,
ensuring data integrity. Users see clear errors instead of wrong calculations.

Fixes #60
2025-12-13 14:02:30 +00:00
..
api fix(api): handle None values in API responses to prevent AttributeError 2025-12-13 14:02:30 +00:00
binary_sensor fix: support main and subunit currency 2025-12-11 23:07:06 +00:00
config_flow_handlers fix(config_flow): restructure options flow to menu-based navigation and fix settings persistence 2025-12-13 13:33:31 +00:00
coordinator fix(api): handle None values in API responses to prevent AttributeError 2025-12-13 14:02:30 +00:00
custom_translations refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
entity_utils refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
interval_pool feat(interval-pool): add intelligent interval caching and memory optimization 2025-11-25 20:44:39 +00:00
sensor fix(config_flow): restructure options flow to menu-based navigation and fix settings persistence 2025-12-13 13:33:31 +00:00
services fix(config_flow): restructure options flow to menu-based navigation and fix settings persistence 2025-12-13 13:33:31 +00:00
translations fix(config_flow): restructure options flow to menu-based navigation and fix settings persistence 2025-12-13 13:33:31 +00:00
utils refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
__init__.py fix(config_flow): restructure options flow to menu-based navigation and fix settings persistence 2025-12-13 13:33:31 +00:00
config_flow.py refactor(config_flow): rename TibberPricesFlowHandler to TibberPricesConfigFlowHandler 2025-11-25 20:44:39 +00:00
const.py fix(config_flow): restructure options flow to menu-based navigation and fix settings persistence 2025-12-13 13:33:31 +00:00
data.py feat(interval-pool): add intelligent interval caching and memory optimization 2025-11-25 20:44:39 +00:00
diagnostics.py refactor: migrate from multi-home to single-home-per-coordinator architecture 2025-11-24 16:24:37 +00:00
entity.py fix(api): handle None values in API responses to prevent AttributeError 2025-12-13 14:02:30 +00:00
icons.json feat(services): add new services and icons for enhanced functionality and user experience 2025-12-02 18:46:15 +00:00
manifest.json chore(release): bump version to 0.22.0 2025-12-11 08:41:55 +00:00
services.yaml refactor(currency): rename minor_currency to subunit_currency in services.yaml 2025-12-11 09:36:24 +00:00