feat(plan): show when live solar may charge the battery - #1485
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Core already lets live solar beyond the plan charge the battery when the plan buys grid energy later at a price above this slot's export price plus the minimum spread (livePVSurplusSoCCap). The plan API did not say so, so the UI could not tell a household whether extra sun will be stored or sold. The SoC ceiling is now computed once when a plan is published, on every solver path and on restore, and stored on each action as live_pv_surplus_soc_cap. Dispatch reads the stored value, so the API shows the number dispatch uses. Refs #1482 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
frahlg
force-pushed
the
1482-plan-capture-field
branch
from
October 1, 2026 17:22
d316cc1 to
7cc8173
Compare
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.
Problem
Refs #1482.
Core already lets live solar beyond the plan charge the battery when the plan buys grid energy later at an import price above this slot's export price plus the minimum spread (
livePVSurplusSoCCap→SlotDirective.LivePVSurplusSoCCap→pvSurplusAbsorbCapin dispatch). Without that permission, an idle or charging arbitrage slot sends surprise sun to the grid.A beta tester saw exactly that (battery idle at 38 %, 3.5 kW to the grid, plan active) and could not tell from the UI why. The plan API did not expose the permission, so the Plan card could not say whether extra sun will be stored or sold.
Change
mpc.Actiongainslive_pv_surplus_soc_cap(0–1 SoC). Core computes it once when it publishes a plan, on every path: replan (every solver and the fallback),InstallPlan, and restore from a diagnostic. The DP shadow copies the plan, so it keeps the values.SlotDirectiveAtreads the stored value instead of recomputing it, so the API shows the number dispatch uses.dispatch.gois untouched (open PRs feat(control): show command limits and measured response tiers #1474 and fix(control): mitigate PV-only export over limits #888 change it).Verification
TestReplanStoresLivePVSurplusSoCCap(external optimizer, Core planner, Core fallback after an optimizer failure),TestReplanWithoutLaterGridChargeSendsZeroLivePVSurplusSoCCap, a restore test, andTestMPCPlanCarriesLivePVSurplusSoCCap(the/api/mpc/planvalue equals the directive value for the same slot).TestSlotDirectiveAtnow publishes throughInstallPlan, with the same assertions.make verifypassed on this commit.#1486 is the Plan card change that reads the field. Either can merge first: the card says nothing about extra sun unless the plan carries the field.
🤖 Generated with Claude Code