Skip to content

fix(ev): let a fresh pilot explain the draw while the driver withholds its limit - #2062

Merged
frahlg merged 1 commit into
masterfrom
2056-pilot-explains-gap
Nov 21, 2026
Merged

frahlg merged 1 commit into
masterfrom
2056-pilot-explains-gap

Conversation

@frahlg

@frahlg frahlg commented Nov 21, 2026

Copy link
Copy Markdown
Member

Problem

#2056: on v0.165.1-beta.1 a steady Easee charge under load balancing turned from "Limited by the charger's load balancing" to "Not following" (power_below_target) for 15 s, then back. FTW ordered 13 A on three phases (8.97 kW), the charger read back 13 A, the pilot was 8 A and the car took 5.44 kW throughout. Pilot confirmations came at 14:14:51 and 14:15:51; the flip ran from 14:15:23 to 14:15:38.

What I found

The load-balancing verdict in classifyControlFeedback needs the driver's current_limit_a. When that field is missing, nothing else explains the draw, and Core goes straight to power_below_target. It does so at once, with no two-minute wait, because the mismatch clock has run since the limit began: the draw was below the order all along, only explained.

The pilot was not the trigger. Confirmed at 14:14:51, it stayed inside Core's 90 s window until 14:16:21, and the verdict came back at 14:15:38, before the next confirmation.

The likely trigger is in the driver. The issue names a test driver built on the open pilot change in srcfl/device-drivers#200 (easee_cloud 1.5.0). That driver reports current_limit_a only while the pilot "answers" the order: the pilot was recorded after the order, or the order has stood 30 s (ORDER_SETTLE_MS). When its reading of Easee's dynamic current (observation 48) changes value, the 30 s start again. Easee records a value only when it changes, so a pilot that holds at 8 A gets no new record, and the driver withholds its limit. Its 20 s hold (LIMIT_RELEASE_HOLD_MS) covers part of that, which leaves about 10 s plus one poll with no limit. With a 5 s poll that fits the report to the second: last limit at 14:15:03, the change seen at 14:15:08, the hold over at 14:15:23, the order settled at 14:15:38. The driver keeps sending the fresh 8 A pilot all the while.

What moved observation 48 is not known. Two causes fit: FTW's own retune by 1 A (at 8.28 kW that is under the 10 % that counts as a new step, so Core keeps its clocks), or Easee resetting its dynamic current and the driver sending the order again (srcfl/device-drivers#227). I have not seen either on hardware. How sure I am:

  • The Core path: sure. The test below replays it and fails on master at the same point.
  • The driver cause: likely, not proven. It is a reading of the driver code that fits the times.

Change

While the driver reports no limit, a fresh pilot below the order is the current the charger lets the car take. It explains a draw that matches it, in the same band as a reported limit. Without the driver's word Core does not name the load balancing, so the verdict is the existing limited / charger_pilot_limit / info: "Limited by the charger", "The charger signals 8 A to the car … The internal limiting cause is unknown." When the driver reports its limit again, the verdict goes back to load_balancer_limit.

  • limit_a in the API still carries only what the driver reports. The fallback lives inside the verdict.
  • A car that takes far less than the pilot, nothing, or more keeps its verdict. A zero pilot, a stale pilot and an older driver without pilot fields change nothing.
  • No new reason or field, so no client owes new words.

Not covered

When the pilot itself is missing or past its 90 s window and the driver reports no limit, Core has no current evidence. It still says Not following once the mismatch clock has run. The #200 driver drops the pilot at 90 s instead of sending it with its old confirmation time. To show "the last pilot is too old" there, that driver would have to keep sending it, and every client would need a verdict and words for it. I left that for a decision.

Evidence

  • TestFreshPilotExplainsTheDrawWhileTheDriverWithholdsItsLimit replays the issue: 13 A order and readback, an 8 A pilot confirmed each minute, 5.44 kW, and the driver's limit gone for 15 s from 30 s after a confirmation. On master it fails at 35 s with not_following/power_below_target/warning. With the fix the gap reads charger_pilot_limit, and the verdict is load_balancer_limit when the limit comes back and after the second confirmation. A second confirmation without the limit keeps charger_pilot_limit. A second case drops the car to 3 kW in the gap and stays power_below_target.
  • cd go && go test ./internal/api/ ./internal/loadpoint/ ./cmd/ftw/ -count=1: all ok.
  • make verify: passed. A first run failed only in TestAViewerMayStillRead, where /api/system/info gave no answer within 5 s under the suite's parallel load. That test does not reach control feedback, and it passed 5 of 5 runs alone; the second make verify run passed.
  • Merged with fix(ev): wait up to 15 minutes while the charger's load balancing holds a start #2050's branch (easee-equalizer-wait) on a scratch branch: no conflict, and the three packages above pass.
  • Not seen on hardware.

Overlap

#2050 is open and touches api_control_feedback.go and api_pilot_evidence_test.go. This change sits in other hunks: the limit block, and a new test at the end of the file. So it branches from master and does not stack. #2017, #1865 and #1789 also touch api_control_feedback.go, in other hunks.

Refs #2056

🤖 Generated with Claude Code

…s its limit

#2056: a steady Easee charge under load balancing (13 A order
and readback, 8 A pilot, 5.44 kW) read Not following for 15 s between
two pilot confirmations a minute apart, though the pilot was still
fresh. The load-balancing verdict needed the driver's current_limit_a;
without it nothing explained the draw, and the mismatch clock, running
since the limit began, made the verdict Not following at once.

The test driver, built on srcfl/device-drivers#200, withholds its limit
for up to 30 s after its order reading moves. While the driver reports
no limit, a fresh pilot below the order now explains a draw that
matches it, as limited/charger_pilot_limit/info. Only the driver can
name the load balancing. A car taking far less than the pilot is still
Not following.

Refs #2056

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 21, 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-21T18:09:13.971039Z db994b7 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.

@frahlg
frahlg merged commit e015cbe into master Nov 21, 2026
21 checks passed
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