Repository navigation
Show the snail icon on low power charge slots in the plan - #5353
Open
springfall2008 wants to merge 8 commits into
Open
springfall2008 wants to merge 8 commits into
springfall2008 wants to merge 8 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
springfall2008
commented
Oct 2, 2026
springfall2008
commented
Oct 2, 2026
springfall2008
commented
Oct 2, 2026
springfall2008
commented
Oct 2, 2026
springfall2008
commented
Oct 2, 2026
…ndow in the plan's charge rate Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
springfall2008
marked this pull request as ready for review
October 9, 2026 19:23
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Partial-row charge windows can be incorrectly marked as low power because rate calculation begins before the charge window.
1 open finding
What changed in this PR
Adds a snail indicator to plan rows where low-power charging requests a reduced rate.
Changes:
- Returns charge rate and low-power status from
get_charge_rate_kw(). - Displays and tests the snail indicator.
- Clarifies plan-card documentation.
| File | Description |
|---|---|
apps/predbat/output.py |
Calculates and displays reduced-charge status. |
apps/predbat/tests/test_plan_why_reason.py |
Adds charge-rate and snail regression cases. |
docs/predbat-plan-card.md |
Documents slow-charge and slow-export indicators. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…an's charge rate publish_html_plan() picks a row's charge window when any step of the row falls inside it, but get_charge_rate_kw() then worked the rate out from the row start. For a window that starts part-way through the row, find_charge_rate() saw extra minutes left, so low power picked a lower rate and the row showed a snail even though the prediction engine charges at full rate from the window's first step. Start from the first prediction step inside the window (the SoC, PV and minute passed to find_charge_rate()), as the engine does. Test 4f covers a window starting 15 minutes into the row; it fails without this change. Addresses the open review thread on output.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in Test 4f's margin Review follow-up: a window starting past forecast_minutes would have looked up a SoC the prediction does not have and fallen back to today's, so only move the start when the window's first step is inside the horizon. Test 4f now sets the low power margin it depends on, and its comment gives the real arithmetic. The docstring says the slot starts at the window's first step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l-icon-5352 # Conflicts: # apps/predbat/output.py
…can pass With the GH#5394 inverter cap merged in, a low power rate below the battery's maximum but above the inverter limit still charged at the inverter's full rate, yet the plan showed a snail. Compare the requested rate against the lower of the battery maximum and the inverter cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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 is an automated draft PR generated from issue #5352 — a maintainer should review it before merging.
Fixes #5352
Summary
A
Chrgslot in the plan now carries the snail (🐌) that a slow export slot already shows, when low power charging (switch.predbat_set_charge_low_power) is asking for less than the maximum charge rate in that slot.Export stores its reduced rate in the limit, so the existing check is a simple decode. Charge has no such encoding - the rate is worked out by
find_charge_rate()as the slot runs - soOutput.get_charge_rate_kw(), which already recomputes that rate for the slot's description text, now also returns whether the requested rate is belowbattery_rate_max_charge.publish_html_plan()appends the snail on that flag.docs/predbat-plan-card.mdalready promised the snail for a slow charge; the sentence is reworded to match what the code does (the snail follows the State, and thelimit.tens_of_percentage_rate_reductionform is export-only and only shown with plan debug on).Testing
./run_pre_commit(fromcoverage/): all hooks passed.tools/triage_test.sh plan_why_reason: fails without the fix, passes with it. Withoutput.pystashed the run fails on the new assertion only (Chrg low power state cell should show the snail like a slow export does (#5352), got: Chrg↗); with the fix restored it passes.test_plan_why_reason.py: the throttled low power slot'sstate_htmlis exactlyChrg↗🐌; a full rate charge with low power off shows no snail; and low power on but a target too far away to throttle (sofind_charge_rate()falls back to the maximum rate) shows no snail. The two no-snail cases pass either way by construction - they are there to pin the behaviour, the first is the one that proves the change.tools/triage_test.sh debug_cases: passed (golden plan JSON unchanged).Notes
get_charge_rate_kw()is the one line to change.rate_kwin the description text, the flag is recomputed for each plan row from the predicted SoC at the start of that row, so a long charge window can show the snail on some rows and not others (e.g. once the remaining window is too short to throttle).get_charge_rate_kw()keeps its name but now returns a(rate_kw, low_power)tuple. GitNexusimpact()reports LOW risk: one caller,publish_html_plan(), updated here.statestring as the export one, so it flows intostate_html/state_textin the plan JSON the same way;state(rawChrg) is unchanged.🤖 Generated with Claude Code