hass.tibber_prices/custom_components/tibber_prices
Julian Pawlowski c316d5deef refactor: resolve circular imports and enhance documentation
This commit completes multiple refactoring efforts and documentation improvements:

Code Structure Changes:
- Move round_to_nearest_quarter_hour() from sensor/helpers.py to average_utils.py
- Resolve circular import between price_utils.py and sensor/helpers.py
- Split api.py into api/ package (client.py, queries.py, exceptions.py, helpers.py)
- Split coordinator.py into coordinator/ package (core.py, cache.py, listeners.py, etc.)
- Move period_utils/ to coordinator/period_handlers/ for better organization
- All lint checks passing (no PLC0415 local import warnings)

Documentation Additions:
- Add docs/development/architecture.md with Mermaid diagrams (end-to-end flow, cache coordination)
- Add docs/development/timer-architecture.md (comprehensive 3-timer system documentation)
- Add docs/development/caching-strategy.md (4-layer cache system with invalidation logic)
- Update docs/development/README.md with cross-references
- Update AGENTS.md with new module structure and patterns

Smart Boundary Tolerance:
- Implement ±2 second tolerance for quarter-hour rounding
- Prevents premature interval switching during HA restarts (14:59:30 stays at 14:45)
- Enables boundary snapping for timer jitter (14:59:58 → 15:00)

Atomic Midnight Coordination:
- Add _check_midnight_turnover_needed() for race-free midnight handling
- Coordinate Timer #1 (HA DataUpdateCoordinator) with Timer #2 (quarter-hour refresh)
- Whoever runs first performs turnover, other skips gracefully

Timer Optimization:
- Change timer scheduling from second=1 to second=0 (absolute-time scheduling)
- Document load distribution rationale (unsynchronized API polling prevents thundering herd)
- Comprehensive explanation of 3 independent timers and their coordination

Impact: Cleaner code structure with resolved circular dependencies, comprehensive
documentation of timer and caching systems, and improved reliability during
boundary conditions and midnight turnovers. All changes are developer-facing
improvements with no user-visible behavior changes.
2025-11-18 17:32:36 +00:00
..
api refactor: resolve circular imports and enhance documentation 2025-11-18 17:32:36 +00:00
binary_sensor feat(sensor): migrate chart_data_export from binary_sensor to sensor platform 2025-11-17 04:11:10 +00:00
config_flow_handlers feat(chart_export): add Chart Data Export diagnostic sensor 2025-11-17 03:14:02 +00:00
coordinator refactor: resolve circular imports and enhance documentation 2025-11-18 17:32:36 +00:00
custom_translations feat(sensor): migrate chart_data_export from binary_sensor to sensor platform 2025-11-17 04:11:10 +00:00
entity_utils feat(sensors): add momentum-based trend detection with two new sensors 2025-11-16 12:49:43 +00:00
sensor refactor: resolve circular imports and enhance documentation 2025-11-18 17:32:36 +00:00
translations feat(sensor): migrate chart_data_export from binary_sensor to sensor platform 2025-11-17 04:11:10 +00:00
__init__.py fix: handle unknown integration version in setup entry 2025-11-09 16:04:04 +00:00
average_utils.py refactor: resolve circular imports and enhance documentation 2025-11-18 17:32:36 +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(chart_export): add Chart Data Export diagnostic sensor 2025-11-17 03:14:02 +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 feat(api): add multi-home support and diagnostic sensors 2025-11-16 00:11:56 +00:00
manifest.json chore(release): bump version to 0.10.0 2025-11-17 04:11:45 +00:00
price_utils.py refactor: resolve circular imports and enhance documentation 2025-11-18 17:32:36 +00:00
services.py feat(chart_export): add Chart Data Export diagnostic sensor 2025-11-17 03:14:02 +00:00
services.yaml feat(chart_export): add Chart Data Export diagnostic sensor 2025-11-17 03:14:02 +00:00