Repository navigation
fix(fetch): compute dawn sensor regardless of combine_charge_slots - #5155
Merged
Merged
Conversation
binary_sensor.predbat_dawn was gated on switch.predbat_combine_charge_slots (off by default) purely as a no-op optimisation for window splitting, so anyone with that switch off saw the sensor read permanently "off" even in broad daylight. calc_pv_light_dark() now always computes calc_dawn()'s result; the window-splitting use was already a no-op in that case (a break every charge_slot_split minutes happens regardless), so behaviour there is unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation, tests, and documentation are consistent and cover the changed configuration behaviour.
Review effort: Lite
Findings: None
What changed in this PR
This PR makes dawn detection independent of combine_charge_slots, ensuring binary_sensor.predbat_dawn reflects the PV forecast by default.
Changes:
- Always compute
calc_dawn()results. - Expand tests across configuration combinations.
- Update dawn sensor documentation.
| File | Description |
|---|---|
apps/predbat/fetch.py |
Removes the dawn-calculation gate and clarifies sensor semantics. |
apps/predbat/tests/test_find_charge_window.py |
Tests dawn detection for all relevant flag combinations. |
docs/output-data.md |
Documents the updated sensor behaviour. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
springfall2008
deleted the
fix/dawn-sensor-combine-charge-slots-gate
branch
September 19, 2026 13:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was written by Claude.
Summary
binary_sensor.predbat_dawn(added in #4726) was gated onswitch.predbat_combine_charge_slots(off by default) as a pure no-op optimisation for the charge-window-splitting use of the same calculation. With that switch off - the default - anyone reading the sensor saw it stuck "off" all day, even in broad daylight with solar generating well abovelow_power_pv_threshold_w.calc_pv_light_dark()now always computescalc_dawn()'s result. The window-splitting consumer (find_charge_window) is unaffected: withcombine_charge_slotsoff it already forces a break everycharge_slot_splitminutes (the same granularitycalc_dawnbuckets at), so the dawn boundary could never actually be reached there - the gate was only ever a no-op for that path, never a behaviour change.Test plan
./run_all --test find_charge_windowpasses, includingtest_calc_pv_light_darkupdated to assertcalc_pv_light_dark()always returnscalc_dawn()'s result across allcombine_charge_slots/set_charge_low_powercombinations./run_all --quickpasses./run_pre_commitpasses