mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-07-27 17:26:48 +00:00
apply_segment_constraints could add far more grid energy than requested when max_cycles_per_day or min_charge_duration_minutes forced bridging across expensive gaps between cheap intervals. With max_cycles_per_day=1, isolated cheap intervals were merged into one continuous segment by filling every gap in between, without ever trimming the surplus back down, resulting in achieved_soc_percent far above 100%. Add a post-bridging trim step that removes segment-edge intervals (highest price first) until total grid energy matches the requested target again, while still respecting max_cycles_per_day/min_charge_duration_minutes and never dropping below the target itself (fixed-power mode's expected last-interval rounding overshoot is preserved). A related edge case is also fixed: trimming could previously remove an interval required to satisfy a must_reach_by deadline, silently flipping deadline_met to False even though the overall energy target was still reached. Deadline-critical intervals are now passed through as protected_starts and are never removed during trimming. Fixes #167 Impact: plan_charging no longer overcharges the battery/EV past the requested target SoC when max_cycles_per_day or min_charge_duration_minutes is set, and must_reach_by deadlines are honored even when those constraints require bridging across expensive price gaps. |
||
|---|---|---|
| .. | ||
| services | ||
| __init__.py | ||
| test_avg_none_fallback.py | ||
| test_best_price_e2e.py | ||
| test_binary_sensor_period_attributes.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_negative_best_price_periods.py | ||
| test_next_api_poll.py | ||
| test_peak_price_e2e.py | ||
| test_percentage_calculations.py | ||
| test_period_calculation.py | ||
| test_period_overlap.py | ||
| test_period_statistics.py | ||
| test_periods_hash.py | ||
| test_price_calculations.py | ||
| test_price_window.py | ||
| test_rating_threshold_validation.py | ||
| test_relaxation.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 | ||