mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +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. |
||
|---|---|---|
| .. | ||
| api | ||
| binary_sensor | ||
| config_flow_handlers | ||
| coordinator | ||
| custom_translations | ||
| entity_utils | ||
| sensor | ||
| services | ||
| translations | ||
| utils | ||
| __init__.py | ||
| config_flow.py | ||
| const.py | ||
| data.py | ||
| diagnostics.py | ||
| entity.py | ||
| manifest.json | ||
| services.yaml | ||