hass.tibber_prices/custom_components/tibber_prices
Julian Pawlowski a75b8ffdb3 perf(coordinator): optimize API calls and data processing
Implemented comprehensive performance optimizations to eliminate asyncio
warnings and reduce unnecessary API calls:

Performance Improvements:
- Two-tier caching: raw API data + transformed data
- Transformation caching prevents re-processing on every coordinator update
- Only retransform when config changes, new data arrives, or midnight turnover
- Reduced coordinator update time from ~120ms to <10ms (cache hits)

API Call Optimization:
- Removed periodic 6-hour "safety" API calls (trust cache validation)
- Random delay (0-30s) for tomorrow data checks (prevents thundering herd)
- API calls only when truly needed (no cache, invalid cache, tomorrow missing)
- Expected reduction: ~50% fewer API calls (from ~4-5/day to ~2/day)

Enhanced Logging:
- Clear [Timer #1/2/3] prefixes for multi-timer system
- Distinguish "Fetching from API" vs "Using cache"
- Separate "Transforming data" vs "Using cached transformed data"
- Hierarchical logging shows which timer triggered which action

Documentation:
- Comprehensive TIMER SYSTEM block explaining three independent timers
- Enhanced docstrings for timer handlers (synchronous callbacks vs async def)
- Clarified why @callback handlers don't use async/await (no I/O operations)
- Updated UPDATE_INTERVAL documentation (removed periodic check reference)

Technical Details:
- _get_current_transformation_config(): Captures all config affecting transformation
- _should_retransform_data(): Intelligent cache invalidation logic
- _should_update_price_data(): Returns bool|"tomorrow_check" to signal delay needed
- Timer handlers use @callback decorator (synchronous, no I/O, fast execution)

Impact: Eliminates asyncio warnings (tasks >0.1s), reduces API load by 50%,
maintains data accuracy through robust cache validation. No user-visible changes.
2025-11-15 18:21:50 +00:00
..
binary_sensor refactor(binary_sensor): split into package matching sensor/ structure 2025-11-15 12:35:02 +00:00
config_flow_handlers refactor(config_flow): restructure package to satisfy hassfest validation 2025-11-15 17:40:53 +00:00
custom_translations feat(sensors): add timing sensors for best_price and peak_price periods 2025-11-15 17:12:55 +00:00
entity_utils feat(sensors): add timing sensors for best_price and peak_price periods 2025-11-15 17:12:55 +00:00
period_utils refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
sensor feat(sensors): add timing sensors for best_price and peak_price periods 2025-11-15 17:12:55 +00:00
translations feat(sensors): add timing sensors for best_price and peak_price periods 2025-11-15 17:12:55 +00:00
__init__.py fix: handle unknown integration version in setup entry 2025-11-09 16:04:04 +00:00
api.py Fix AttributeError when homes lack active subscriptions (#28) 2025-11-15 13:08:15 +01:00
average_utils.py refactor(sensors): Refactor price sensor calculations and remove unused methods 2025-11-15 09:29:33 +00:00
config_flow.py refactor(config_flow): restructure package to satisfy hassfest validation 2025-11-15 17:40:53 +00:00
const.py feat(sensors): add timestamp attributes and enhance icon system 2025-11-15 15:31:43 +00:00
coordinator.py perf(coordinator): optimize API calls and data processing 2025-11-15 18:21:50 +00:00
data.py refactoring 2025-04-23 16:42:31 +00:00
diagnostics.py update dev environment 2025-11-03 15:54:01 +00:00
entity.py fix: Remove unused model_id attribute from TibberPricesEntity 2025-11-07 14:45:33 +00:00
manifest.json chore(release): bump version to 0.6.1 2025-11-14 01:14:05 +00:00
price_utils.py refactor(sensors): rename current price sensors for clarity 2025-11-15 08:30:25 +00:00
services.py refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
services.yaml update 2025-05-25 22:15:25 +00:00