Repository navigation
fix(control): an unplugged car is no EV cut the battery waits for (#1674) - #1713
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 753aa856c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
) Codex on #1706: with several managed chargers, unplugging one car during an overage of the hour's import limit dropped its offer from the pool. pendingEVCutW counted that drop as a cut Core sent, although the meter may already show the unplug, and held back battery relief for up to 20 s. The EV guard now notes which loadpoints are plugged. When a car leaves or joins, the run's baseline restarts at the pool's offer then, so only cuts sent to cars still plugged count. Our own commands only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
…es (#1674) Codex on #1713: restarting the whole pool's baseline when a car left also dropped a cut already sent to a car that stays. The battery then covered that cut too, and the site could export when it landed. The EV guard now notes each charger's offer when a run over the hour's limit begins. pendingEVCutW sums, over chargers still plugged, the start offer less this tick's offer. A car that leaves drops out; a car that joins has no start offer. main.go hands Core this tick's offers per driver through SetEVCommanded, from loadpoint.CommandedEVPowerByDriver, which keeps a stopped car at 0 W. Our own commands only; the 20 s cap stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
frahlg
force-pushed
the
1674-ev-cut-pool-change
branch
from
October 17, 2026 17:49
753aa85 to
af68921
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.
Follow-up to #1706 for its Codex findings. #1674.
Problem
pendingEVCutWcounts the EV cut Core sent during an overage of the hour's import limit, so the battery does not discharge for the same watts. It took the pool's total offer when the overage began, less this tick's total. Two Codex findings:ev_fuse_budget.go:328): with two managed chargers, unplugging one during the overage dropped its offer from the total. That counted as a cut Core sent, although the meter may already show the unplug, so battery relief was held back for up to 20 s.ev_fuse_budget.go:138): restarting the whole baseline when a car left also dropped a cut already sent to a car that stays. The battery then covered that cut too, and the site could export when it landed.Change
The baseline is now per charger:
overOffers).pendingEVCutWis the sum, over chargers still plugged, of max(0, offer at run start − offer this tick).For the offers this tick per charger,
main.gonow callsctrl.SetEVCommanded(lpStatesSnapshot). It setsEVCommandedWas before, plus a per-driver map from the newloadpoint.CommandedEVPowerByDriver, which keeps a stopped car at 0 W.CommandedEVPowerWnow sums that map, with the same result as before. The key is the charger driver, asCommandedEVPowerWalready counts a driver once; that is one per loadpoint in the usual case.Results
TestUnpluggedCarIsNoCutTheBatteryWaitsFor: two cars at 5,520 W; car b unplugged during an 880 W overage, no cut sentTestCutOnStayingCarStillWaitsWhenAnotherLeaves: Core stops car a (10,350 W) during an overage; car b (4,140 W) unplugged 5 s later; a's stop lands at 10 sThe earlier tests in the file keep their results.
Limits
Test plan
make verifybash .github/scripts/check-telemetry-reads.sh origin/master: none added🤖 Generated with Claude Code