Repository navigation
Show the snail icon on low power charge slots in the plan - #5353
Open
springfall2008 wants to merge 2 commits into
Open
springfall2008 wants to merge 2 commits into
springfall2008 wants to merge 2 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.
Comment on lines
+1095
to
1097
| # The window end is floored to a step boundary, as the prediction engine does | ||
| window_end_rel = min(max(((window["end"] - self.minutes_now) // PREDICT_STEP) * PREDICT_STEP, minute_relative_start), self.forecast_minutes) | ||
| pv_window_kwh = sum(pv_forecast_minute_step.get(m, 0.0) for m in range(minute_relative_start, window_end_rel, PREDICT_STEP)) |
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