hass.tibber_prices/custom_components/tibber_prices/config_flow_handlers
Julian Pawlowski 14b68a504b refactor(config): optimize volatility thresholds with separate ranges and improved UX
Volatility Threshold Optimization:
- Replaced global MIN/MAX_VOLATILITY_THRESHOLD (0-100%) with six separate
  constants for overlapping ranges per threshold level
- MODERATE: 5.0-25.0% (was: 0-100%)
- HIGH: 20.0-40.0% (was: 0-100%)
- VERY_HIGH: 35.0-80.0% (was: 0-100%)
- Added detailed comments explaining ranges and cascading requirements

Validators:
- Added three specific validation functions (one per threshold level)
- Added cross-validation ensuring MODERATE < HIGH < VERY_HIGH
- Added fallback to existing option values for completeness check
- Updated error keys to specific messages per threshold level

UI Improvements:
- Changed NumberSelector mode: BOX → SLIDER (consistency with other config steps)
- Changed step size: 0.1% → 1.0% (better UX, sufficient precision)
- Updated min/max ranges to match new validation constants

Translations:
- Removed: "invalid_volatility_threshold" (generic)
- Added: "invalid_volatility_threshold_moderate/high/very_high" (specific ranges)
- Added: "invalid_volatility_thresholds" (cross-validation error)
- Updated all 5 languages (de, en, nb, nl, sv)

Files modified:
- config_flow_handlers/options_flow.py: Updated validation logic
- config_flow_handlers/schemas.py: Updated NumberSelector configs
- config_flow_handlers/validators.py: Added specific validators + cross-validation
- const.py: Replaced global constants with six specific constants
- translations/*.json: Updated error messages (5 languages)

Impact: Users get clearer validation errors with specific ranges shown,
better UX with sliders and appropriate step size, and guaranteed
threshold ordering (MODERATE < HIGH < VERY_HIGH).
2025-11-21 17:31:07 +00:00
..
__init__.py refactor(naming): complete class naming convention alignment 2025-11-20 11:22:53 +00:00
options_flow.py refactor(config): optimize volatility thresholds with separate ranges and improved UX 2025-11-21 17:31:07 +00:00
schemas.py refactor(config): optimize volatility thresholds with separate ranges and improved UX 2025-11-21 17:31:07 +00:00
subentry_flow.py feat(api): add multi-home support and diagnostic sensors 2025-11-16 00:11:56 +00:00
user_flow.py refactor(naming): complete class naming convention alignment 2025-11-20 11:22:53 +00:00
validators.py refactor(config): optimize volatility thresholds with separate ranges and improved UX 2025-11-21 17:31:07 +00:00