hass.tibber_prices/docs/user
Julian Pawlowski 457fa7c03f refactor(periods): merge adjacent periods and remove is_extension logic
BREAKING CHANGE: Period overlap resolution now merges adjacent/overlapping periods
instead of marking them as extensions. This simplifies automation logic and provides
clearer period boundaries for users.

Previous Behavior:
- Adjacent periods created by relaxation were marked with is_extension=true
- Multiple short periods instead of one continuous period
- Complex logic needed to determine actual period length in automations

New Behavior:
- Adjacent/overlapping periods are merged into single continuous periods
- Newer period's relaxation attributes override older period's
- Simpler automation: one period = one continuous time window

Changes:
- Period Overlap Resolution (new file: period_overlap.py):
  * Added merge_adjacent_periods() to combine periods and preserve attributes
  * Rewrote resolve_period_overlaps() with simplified merge logic
  * Removed split_period_by_overlaps() (no longer needed)
  * Removed is_extension marking logic
  * Removed unused parameters: min_period_length, baseline_periods

- Relaxation Strategy (relaxation.py):
  * Removed all is_extension filtering from period counting
  * Simplified standalone counting to just len(periods)
  * Changed from period_merging import to period_overlap import
  * Added MAX_FLEX_HARD_LIMIT constant (0.50)
  * Improved debug logging for merged periods

- Code Quality:
  * Fixed all remaining linter errors (N806, PLR2004, PLR0912)
  * Extracted magic values to module-level constants:
    - FLEX_SCALING_THRESHOLD = 0.20
    - SCALE_FACTOR_WARNING_THRESHOLD = 0.8
    - MAX_FLEX_HARD_LIMIT = 0.50
  * Added appropriate noqa comments for unavoidable patterns

- Configuration (from previous work in this session):
  * Removed CONF_RELAXATION_STEP_BEST, CONF_RELAXATION_STEP_PEAK
  * Hard-coded 3% relaxation increment for reliability
  * Optimized defaults: RELAXATION_ATTEMPTS 8→11, ENABLE_MIN_PERIODS False→True,
    MIN_PERIODS undefined→2
  * Removed relaxation_step UI fields from config flow
  * Updated all 5 translation files

- Documentation:
  * Updated period_handlers/__init__.py: period_merging → period_overlap
  * No user-facing docs changes needed (already described continuous periods)

Rationale - Period Merging:
User experience was complicated by fragmented periods:
- Automations had to check multiple adjacent periods
- Binary sensors showed ON/OFF transitions within same cheap time
- No clear way to determine actual continuous period length

With merging:
- One continuous cheap time = one period
- Binary sensor clearly ON during entire period
- Attributes show merge history via merged_from dict
- Relaxation info preserved from newest/highest flex period

Rationale - Hard-Coded Relaxation Increment:
The configurable relaxation_step parameter proved problematic:
- High base flex + high step → rapid explosion (40% base + 10% step → 100% in 6 steps)
- Users don't understand the multiplicative nature
- 3% increment provides optimal balance: 11 attempts to reach 50% hard cap

Impact:
- Existing installations: Periods may appear longer (merged instead of split)
- Automations benefit from simpler logic (no is_extension checks needed)
- Custom relaxation_step values will use new 3% increment
- Users may need to adjust relaxation_attempts if they relied on high step sizes
2025-11-19 20:16:58 +00:00
..
automation-examples.md docs(user): add dynamic icon and color guides for dashboard customization 2025-11-15 18:00:38 +00:00
configuration.md docs: restructure documentation and add AI development disclosure 2025-11-09 14:25:27 +00:00
dynamic-icons.md docs(user): add dynamic icon and color guides for dashboard customization 2025-11-15 18:00:38 +00:00
icon-colors.md docs(user): add dynamic icon and color guides for dashboard customization 2025-11-15 18:00:38 +00:00
installation.md docs: restructure documentation and add AI development disclosure 2025-11-09 14:25:27 +00:00
period-calculation.md refactor(periods): merge adjacent periods and remove is_extension logic 2025-11-19 20:16:58 +00:00
README.md docs(user): add dynamic icon and color guides for dashboard customization 2025-11-15 18:00:38 +00:00
sensors.md feat(sensor): migrate chart_data_export from binary_sensor to sensor platform 2025-11-17 04:11:10 +00:00
services.md feat(sensor): migrate chart_data_export from binary_sensor to sensor platform 2025-11-17 04:11:10 +00:00
troubleshooting.md docs: restructure documentation and add AI development disclosure 2025-11-09 14:25:27 +00:00

User Documentation

Welcome to Tibber Prices! This integration provides enhanced electricity price data from Tibber with quarter-hourly precision, statistical analysis, and intelligent ratings.

📚 Documentation

🚀 Quick Start

  1. Install via HACS (add as custom repository)
  2. Add Integration in Home Assistant → Settings → Devices & Services
  3. Enter Tibber API Token (get yours at developer.tibber.com)
  4. Configure Price Thresholds (optional, defaults work for most users)
  5. Start Using Sensors in automations, dashboards, and scripts!

Key Features

  • Quarter-hourly precision - 15-minute intervals for accurate price tracking
  • Statistical analysis - Trailing/leading 24h averages for context
  • Price ratings - LOW/NORMAL/HIGH classification based on your thresholds
  • Best/Peak hour detection - Automatic detection of cheapest/peak periods with configurable filters (learn how)
  • ApexCharts integration - Custom services for beautiful price charts
  • Multi-currency support - EUR, NOK, SEK with proper minor units (ct, øre, öre)

🤝 Need Help?


Note: These guides are for end users. If you want to contribute to development, see the Developer Documentation.