Skip to content

fix(ev): name a declined car's stop instead of an empty plan - #2082

Open
frahlg wants to merge 2 commits into
masterfrom
fix-2080
Open

frahlg wants to merge 2 commits into
masterfrom
fix-2080

Conversation

@frahlg

@frahlg frahlg commented Nov 25, 2026

Copy link
Copy Markdown
Member

Refs #2080

Problem

A tester's car had a goal of 100 % by a morning deadline, was plugged in and enabled, and got 0 W all night. The planner had no flex loads, and the charger's control feedback said waiting / no_plan_budget with vehicle_request_active: true. That reads as "the plan chose not to charge a car that wants charge". It was not why.

Root cause

The help file shows the sequence. The car charged for about 20 minutes under a planned offer, then stopped asking for current. The charger said so (Easee reason 50 or op mode 4) while Core still offered the full rate. After SessionCompletionTimeout (90 s) the loadpoint latched charging_declined, as designed. The loadpoint provider in go/cmd/ftw/main.go skips a declined loadpoint, so the next replan sent flex_loads: []. The same pattern shows on an earlier night in the same file.

With no budget, tickOne names the 0 W no_plan_budget. Under Core's own 0 A, the Easee reports reason 52 ("max dynamic charger current too low"), which its driver maps to request_active: true because the box, not the car, stopped the current. So the one honest signal, vehicle_declined, disappeared as soon as Core stopped offering, and the feedback blamed the plan.

The latch itself is deliberate. It keeps the plan from reserving energy for a car that will not take it, and it clears on unplug, a higher goal, Charge now, or measured charging. The level was inferred, so Core cannot tell whether the car was at its own limit. docs/architecture.md says a charger declining current is reported as a refusal. Here it was reported as an empty plan.

Master (v0.168.0) has the same code path.

Fix

When the plan gives a loadpoint no budget and that loadpoint has latched ChargingDeclined, the controller names the stop vehicle_not_requesting. That is the reason Core already uses for the same latch on vehicle-limit goals (vehicleCompletionOffer). Web and the iOS app already label it "Car not taking power". The change adds no new reason name, setting or behaviour. Planning, dispatch and the latch's exits stay as they were. No battery level is invented from the stop.

Not in scope: whether Core should offer a declined car current again later in a long session (for example at the next recurring deadline). That would change behaviour, and the owner should decide it.

Tests

  • TestCommandedReasonDeclinedCarIsNotAnEmptyPlan (loadpoint) follows the field sequence through the real latch. On master it fails with got (0, "no_plan_budget"). With the fix it passes.
  • TestCoreStopForANotRequestingCarIsFollowing (api) now also covers the charger reporting the car as asking under Core's 0 A. The verdict stays following / vehicle_not_requesting.
  • go test ./internal/loadpoint/ ./internal/api/ ./internal/mpc/ pass.
  • GOFLAGS=-p=4 make verify: vet, tests (88 packages ok) and build clean.

Changeset: patch. It corrects a reason name for an existing state and adds no capability.

🤖 Generated with Claude Code

A car that stopped asking for current while the plan offered it latches
charging_declined after 90 s, and the planner leaves it out for the
session. The controller then named its 0 W no_plan_budget, and under
Core's own 0 A the charger reports the car as asking again, so the
feedback read as a plan that chose not to charge a car that wanted it.

Name that stop vehicle_not_requesting, the reason Core already gives the
same latch on vehicle-limit goals. Planning, dispatch and the latch's
exits are unchanged.

Refs #2080

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T07:35:01.104428Z 4e4151c PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The comment now covers a missing plan or directive, not only a plan
that leaves the car out. The changeset lists every exit from the latch.

Refs #2080

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant