mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-04-07 08:03:40 +00:00
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. |
||
|---|---|---|
| .. | ||
| services | ||
| __init__.py | ||
| test_avg_none_fallback.py | ||
| test_best_price_e2e.py | ||
| test_config_validators.py | ||
| test_coordinator_shutdown.py | ||
| test_interval_pool_memory_leak.py | ||
| test_interval_pool_optimization.py | ||
| test_level_filtering.py | ||
| test_lifecycle_state.py | ||
| test_mean_median_display.py | ||
| test_midnight_handler.py | ||
| test_midnight_periods.py | ||
| test_midnight_turnover.py | ||
| test_minmax_none_fallback.py | ||
| test_next_api_poll.py | ||
| test_peak_price_e2e.py | ||
| test_percentage_calculations.py | ||
| test_period_calculation.py | ||
| test_price_calculations.py | ||
| test_rating_threshold_validation.py | ||
| test_resource_cleanup.py | ||
| test_sensor_consistency.py | ||
| test_sensor_timer_assignment.py | ||
| test_time_service.py | ||
| test_timer_scheduling.py | ||
| test_tomorrow_data_refresh.py | ||
| test_user_data_validation.py | ||