hass.tibber_prices/custom_components/tibber_prices
Julian Pawlowski 1e1c8d5299 feat(periods): handle flat days and absolute low-price scenarios
Three complementary fixes for pathological price days:

1. Adaptive min_periods for flat days (CV ≤ 10%):
   On days with nearly uniform prices (e.g. solar surplus), enforcing
   multiple distinct cheap periods is geometrically impossible.
   _compute_day_effective_min() detects CV ≤ LOW_CV_FLAT_DAY_THRESHOLD
   and reduces the effective target to 1 for that day (best price only;
   peak price always runs full relaxation).

2. min_distance scaling on absolute low-price days:
   When the daily average drops below 0.10 EUR (10 ct), percentage-based
   min_distance becomes unreliable. The threshold is scaled linearly to
   zero so the filter neither accepts the entire day nor blocks everything.

3. CV quality gate bypass for absolute low-price periods:
   Periods with a mean below 0.10 EUR may show high relative CV even
   though the absolute price differences are fractions of a cent.
   Both _check_period_quality() and _check_merge_quality_gate() now
   bypass the CV gate below this threshold.

Additionally: span-aware flex warnings now emit INFO/WARNING when
base_flex >= 25%/30% and at least one "normal" (non-V-shape) day
exists (FLEX_WARNING_VSHAPE_RATIO = 0.5). Previously the constants
were defined but never used.

Updated 3 test assertions in test_best_price_e2e.py: the flat-day
fixture (CV ~5.4%) correctly produces 1 period, not 2.

Impact: Best Price periods now appear reliably on V-shape solar days
and flat-price days. No more "0 periods" on days where the single
cheapest window is a valid and useful result.
2026-04-06 12:18:40 +00:00
..
api fix(api): handle None values in API responses to prevent AttributeError 2025-12-13 14:02:30 +00:00
binary_sensor fix(sensor): best price calculation on v-shaped days 2026-04-06 11:13:09 +00:00
config_flow_handlers fix(translations): update API token instructions to use placeholder for Tibber URL 2026-03-29 18:19:42 +00:00
coordinator feat(periods): handle flat days and absolute low-price scenarios 2026-04-06 12:18:40 +00:00
custom_translations feat(config_flow): show override warnings when config entities control settings 2026-01-21 17:36:51 +00:00
entity_utils fix(sensor): best price calculation on v-shaped days 2026-04-06 11:13:09 +00:00
interval_pool fix(interval_pool): fix DST spring-forward causing missing tomorrow intervals 2026-03-29 18:42:27 +00:00
number fix(sensor): best price calculation on v-shaped days 2026-04-06 11:13:09 +00:00
sensor fix(sensor): best price calculation on v-shaped days 2026-04-06 11:13:09 +00:00
services fix(sensor): best price calculation on v-shaped days 2026-04-06 11:13:09 +00:00
switch fix(sensor): best price calculation on v-shaped days 2026-04-06 11:13:09 +00:00
translations fix(translations): update API token instructions to use placeholder for Tibber URL 2026-03-29 18:19:42 +00:00
utils feat(sensors): add 5-level price trend scale with configurable thresholds 2026-01-20 13:36:01 +00:00
__init__.py feat(config_flow): show override warnings when config entities control settings 2026-01-21 17:36:51 +00:00
config_flow.py feat(config_flow): add price level gap tolerance for Tibber API level field 2025-12-22 20:25:30 +00:00
const.py feat(sensors): add 5-level price trend scale with configurable thresholds 2026-01-20 13:36:01 +00:00
data.py feat(interval-pool): add intelligent interval caching and memory optimization 2025-11-25 20:44:39 +00:00
diagnostics.py refactor(lifecycle): integrate with Pool for sensor metrics 2025-12-23 14:13:34 +00:00
entity.py fix(sensor): best price calculation on v-shaped days 2026-04-06 11:13:09 +00:00
icons.json feat(services): add hourly resolution option for chart data services 2026-01-20 15:51:34 +00:00
manifest.json chore(release): bump version to 0.27.0 2026-03-29 18:49:21 +00:00
services.yaml feat(services): add hourly resolution option for chart data services 2026-01-20 15:51:34 +00:00