hass.tibber_prices/custom_components/tibber_prices
Julian Pawlowski 23b8bd1c62 feat(periods): modularize period_utils and add statistical outlier filtering
Refactored monolithic period_utils.py (1800 lines) into focused modules
for better maintainability and added advanced outlier filtering with
smart impact tracking.

Modular structure:
- types.py: Type definitions and constants (89 lines)
- level_filtering.py: Level filtering with gap tolerance (121 lines)
- period_building.py: Period construction from intervals (238 lines)
- period_statistics.py: Statistics and summaries (318 lines)
- period_merging.py: Overlap resolution (382 lines)
- relaxation.py: Per-day relaxation strategy (547 lines)
- core.py: Main API orchestration (251 lines)
- outlier_filtering.py: Statistical spike detection (294 lines)
- __init__.py: Public API exports (62 lines)

New statistical outlier filtering:
- Linear regression for trend-based spike detection
- 2 standard deviation confidence intervals (95%)
- Symmetry checking to preserve legitimate price shifts
- Enhanced zigzag detection with relative volatility (catches clusters)
- Replaces simple average smoothing with trend-based predictions

Smart impact tracking:
- Tests if original price would have passed criteria
- Only counts smoothed intervals that actually changed period formation
- Tracks level gap tolerance usage separately
- Both attributes only appear when > 0 (clean UI)

New period attributes:
- period_interval_smoothed_count: Intervals kept via outlier smoothing
- period_interval_level_gap_count: Intervals kept via gap tolerance

Impact: Statistical outlier filtering prevents isolated price spikes from
breaking continuous periods while preserving data integrity. All statistics
use original prices. Smart tracking shows only meaningful interventions,
making it clear when tolerance mechanisms actually influenced results.

Backwards compatible: All public APIs re-exported from period_utils package.
2025-11-12 16:37:34 +00:00
..
custom_translations fix(translations): restore corrupted Norwegian and Dutch translations 2025-11-09 15:31:56 +00:00
period_utils feat(periods): modularize period_utils and add statistical outlier filtering 2025-11-12 16:37:34 +00:00
translations feat(period-calc): adaptive defaults + remove volatility filter 2025-11-12 13:20:14 +00:00
__init__.py fix: handle unknown integration version in setup entry 2025-11-09 16:04:04 +00:00
api.py fix: update return type annotation for API request method and ensure exceptions are raised 2025-11-09 16:04:12 +00:00
average_utils.py feat: Add function to calculate average price for the next N hours 2025-11-06 22:35:53 +00:00
binary_sensor.py feat(periods): add adaptive filter relaxation for minimum period guarantee 2025-11-10 03:34:09 +00:00
config_flow.py feat(period-calc): adaptive defaults + remove volatility filter 2025-11-12 13:20:14 +00:00
const.py feat(period-calc): adaptive defaults + remove volatility filter 2025-11-12 13:20:14 +00:00
coordinator.py feat(period-calc): adaptive defaults + remove volatility filter 2025-11-12 13:20:14 +00:00
data.py refactoring 2025-04-23 16:42:31 +00:00
diagnostics.py update dev environment 2025-11-03 15:54:01 +00:00
entity.py fix: Remove unused model_id attribute from TibberPricesEntity 2025-11-07 14:45:33 +00:00
manifest.json chore(release): bump version to 0.4.1 2025-11-11 21:22:36 +00:00
price_utils.py refactor(periods): move all period logic to coordinator and refactor period_utils 2025-11-09 23:46:48 +00:00
sensor.py refactor(periods): move all period logic to coordinator and refactor period_utils 2025-11-09 23:46:48 +00:00
services.py refactor(periods): move all period logic to coordinator and refactor period_utils 2025-11-09 23:46:48 +00:00
services.yaml update 2025-05-25 22:15:25 +00:00