hass.tibber_prices/custom_components/tibber_prices
Julian Pawlowski d90266e1ad refactor(config_flow): split monolithic file into modular package structure
Refactored config_flow.py (995 lines) into focused modules within config_flow/
package to improve maintainability and code organization.

Changes:
- Created config_flow/ package with 6 specialized modules (1,260 lines total)
- Extracted validators to validators.py (95 lines) - pure, testable functions
- Extracted schemas to schemas.py (577 lines) - centralized vol.Schema definitions
- Split flow handlers into separate files:
  * user_flow.py (274 lines) - Main config flow (setup + reauth)
  * subentry_flow.py (124 lines) - Subentry flow (add homes)
  * options_flow.py (160 lines) - Options flow (6-step configuration wizard)
- Package exports via __init__.py (50 lines) for backward compatibility
- Deleted config_flow_legacy.py (no longer needed)

Technical improvements:
- Used Mapping[str, Any] for config_entry.options compatibility
- Proper TYPE_CHECKING imports for circular dependency management
- All 10 inline vol.Schema definitions replaced with reusable functions
- Validators are pure functions (no side effects, easily testable)
- Clear separation of concerns (validation, schemas, flows)

Documentation:
- Updated AGENTS.md with new package structure
- Updated config flow patterns and examples
- Added "Add a new config flow step" guide to Common Tasks
- Marked refactoring plan as COMPLETED with lessons learned

Verification:
- All linting checks pass (./scripts/lint-check)
- All flow handlers import successfully
- Home Assistant loads integration without errors
- All flow types functional (user, subentry, options, reauth)
- No user-facing changes (backward compatible)

Impact: Improves code maintainability by organizing 995 lines into 6 focused
modules (avg 210 lines/module). Enables easier testing, future modifications,
and onboarding of new contributors.
2025-11-15 13:03:13 +00:00
..
binary_sensor refactor(binary_sensor): split into package matching sensor/ structure 2025-11-15 12:35:02 +00:00
config_flow refactor(config_flow): split monolithic file into modular package structure 2025-11-15 13:03:13 +00:00
custom_translations refactor(sensors): rename current price sensors for clarity 2025-11-15 08:30:25 +00:00
entity_utils refactor(sensors): Transform sensor platform into package 2025-11-15 11:46:54 +00:00
period_utils refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
sensor refactor(sensors): Transform sensor platform into package 2025-11-15 11:46:54 +00:00
translations refactor(sensors): rename current price sensors for clarity 2025-11-15 08:30:25 +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
const.py refactor(sensors): Transform sensor platform into package 2025-11-15 11:46:54 +00:00
coordinator.py refactor(sensors): rename current price sensors for clarity 2025-11-15 08:30:25 +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