mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-30 13:23:41 +00:00
Split services.py (1,097 lines) into modular package (6 files, ~200-600 lines each): Structure: - services/__init__.py: Service registration (70 lines) - services/helpers.py: Entry validation (55 lines) - services/formatters.py: Data transformation (380 lines) - services/chartdata.py: Chart data export handler (600 lines) - services/apexcharts.py: ApexCharts YAML generator (240 lines) - services/refresh_user_data.py: User data refresh (110 lines) Benefits: - Clear separation of concerns (helpers, formatters, handlers) - Each service isolated and independently testable - Consistent handler naming (handle_* pattern) - Better code reuse through formatters module All services working identically (get_chartdata, get_apexcharts_yaml, refresh_user_data). Updated __init__.py to import from services package. Impact: Improved maintainability, reduced max file size from 1,097 to 600 lines. Architecture quality improved from 7.5/10 to ~8.5/10. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| apexcharts.py | ||
| chartdata.py | ||
| formatters.py | ||
| helpers.py | ||
| refresh_user_data.py | ||