mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
Fixes bug where lifecycle sensor attributes (data_completeness, tomorrow_available) didn't update after tomorrow data was successfully fetched from API. Root cause: DataTransformer had cached transformation data but no mechanism to detect when source API data changed (only checked config and midnight turnover). Changes: - coordinator/data_transformation.py: Track source_data_timestamp and invalidate cache when timestamp changes (detects new API data arrival) - coordinator/data_transformation.py: Integrate period calculation into DataTransformer (calculate_periods_fn parameter) for complete single-layer caching - coordinator/core.py: Remove duplicate transformation cache (_cached_transformed_data, _last_transformation_config), simplify _transform_data_for_*() to direct delegation - tests/test_tomorrow_data_refresh.py: Add 3 regression tests for cache invalidation (new timestamp, config change behavior, cache preservation) Impact: Lifecycle sensor attributes now update correctly when new API data arrives. Reduced code by ~40 lines in coordinator, consolidated caching to single layer. All 350 tests passing. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_avg_none_fallback.py | ||
| test_best_price_e2e.py | ||
| test_cache_age.py | ||
| test_cache_validity.py | ||
| test_cache_validity_after_midnight.py | ||
| test_config_validators.py | ||
| test_coordinator_shutdown.py | ||
| test_level_filtering.py | ||
| test_lifecycle_state.py | ||
| test_midnight_handler.py | ||
| test_midnight_periods.py | ||
| test_midnight_turnover.py | ||
| test_minmax_none_fallback.py | ||
| test_next_api_poll.py | ||
| test_peak_price_e2e.py | ||
| test_percentage_calculations.py | ||
| test_period_calculation.py | ||
| test_price_calculations.py | ||
| test_rating_threshold_validation.py | ||
| test_resource_cleanup.py | ||
| test_sensor_consistency.py | ||
| test_sensor_timer_assignment.py | ||
| test_time_service.py | ||
| test_timer_scheduling.py | ||
| test_tomorrow_data_refresh.py | ||