Skip to content

Show the snail icon on low power charge slots in the plan - #5353

Open
springfall2008 wants to merge 8 commits into
mainfrom
feat/slow-charge-snail-icon-5352
Open

springfall2008 wants to merge 8 commits into
mainfrom
feat/slow-charge-snail-icon-5352

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

This is an automated draft PR generated from issue #5352 — a maintainer should review it before merging.

Fixes #5352

Summary

A Chrg slot 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 - so Output.get_charge_rate_kw(), which already recomputes that rate for the slot's description text, now also returns whether the requested rate is below battery_rate_max_charge. publish_html_plan() appends the snail on that flag.

docs/predbat-plan-card.md already promised the snail for a slow charge; the sentence is reworded to match what the code does (the snail follows the State, and the limit.tens_of_percentage_rate_reduction form is export-only and only shown with plan debug on).

Testing

  • ./run_pre_commit (from coverage/): all hooks passed.
  • tools/triage_test.sh plan_why_reason: fails without the fix, passes with it. With output.py stashed 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.
  • New assertions in test_plan_why_reason.py: the throttled low power slot's state_html is exactly Chrg↗🐌; a full rate charge with low power off shows no snail; and low power on but a target too far away to throttle (so find_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

  • What counts as slow. The snail keys on the rate low power mode requests, not the rate achieved after the battery charge curve. A full rate charge that the curve tapers near the top of the battery therefore gets no snail, which mirrors export, where the snail marks a planned reduced rate rather than a physical limit. The issue says "when the power is less than the maximum"; if the taper should count too, the comparison in get_charge_rate_kw() is the one line to change.
  • Per-row, from predicted SoC. Like the rate_kw in 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. GitNexus impact() reports LOW risk: one caller, publish_html_plan(), updated here.
  • The snail is appended to the same state string as the export one, so it flows into state_html / state_text in the plan JSON the same way; state (raw Chrg) is unchanged.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@springfall2008 springfall2008 self-assigned this Oct 2, 2026
@springfall2008 springfall2008 added BOT_REVIEW Trigger an autotriage BOT_CLEANUP Trigger: bot should address PR review feedback and CI failures, then commit and push labels Oct 2, 2026
Comment thread apps/predbat/output.py Resolved
Comment thread apps/predbat/output.py Resolved
Comment thread apps/predbat/output.py Resolved
Comment thread apps/predbat/output.py Resolved
@springfall2008 springfall2008 removed the BOT_REVIEW Trigger an autotriage label Oct 2, 2026
…ndow in the plan's charge rate

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@springfall2008 springfall2008 removed the BOT_CLEANUP Trigger: bot should address PR review feedback and CI failures, then commit and push label Oct 2, 2026
@springfall2008
springfall2008 marked this pull request as ready for review October 9, 2026 19:23
Copilot AI balanced review requested due to automatic review settings October 9, 2026 19:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 thread apps/predbat/output.py Resolved
chalfontchubby and others added 3 commits October 22, 2026 09:02
…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>
@chalfontchubby chalfontchubby added the BOT_PR_OPENED Bot PR flow opened a draft PR for this ticket label Oct 25, 2026
@chalfontchubby chalfontchubby self-assigned this Oct 25, 2026
chalfontchubby and others added 2 commits October 28, 2026 22:10
…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BOT_PR_OPENED Bot PR flow opened a draft PR for this ticket

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show snail icon for slow charge slots

4 participants