mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
The outlier filter was incorrectly smoothing daily minimum/maximum prices, causing best/peak price periods to miss their most important intervals. Root cause: When the daily minimum (e.g., 0.5535 kr at 05:00) was surrounded by higher prices, the trend-based prediction calculated an "expected" price (0.6372 kr) that exceeded the flex threshold (0.6365 kr), causing the interval to be excluded from the best price period. Solution: Daily extremes are now protected from smoothing. Before applying any outlier detection, we calculate daily min/max prices and skip smoothing for any interval at or within 0.1% of these values. Changes: - Added _calculate_daily_extremes() to compute daily min/max - Added _is_daily_extreme() to check if price should be protected - Added EXTREMES_PROTECTION_TOLERANCE constant (0.1%) - Updated filter_price_outliers() to skip extremes before analysis - Enhanced logging to show protected interval count Impact: Best price periods now correctly include daily minimum intervals, and peak price periods correctly include daily maximum intervals. The period for 2024-12-23 now extends from 03:15-05:30 (10 intervals) instead of incorrectly stopping at 05:00 (7 intervals). |
||
|---|---|---|
| .. | ||
| tibber_prices | ||