Skip to content

fix(easee_cloud): re-send the current limit as a command (1.4.2) - #227

Open
erikarenhill wants to merge 2 commits into
srcfl:mainfrom
erikarenhill:fix/easee-resend-limit-as-command
Open

erikarenhill wants to merge 2 commits into
srcfl:mainfrom
erikarenhill:fix/easee-resend-limit-as-command

Conversation

@erikarenhill

@erikarenhill erikarenhill commented Nov 14, 2026 •

Copy link
Copy Markdown

Summary

Easee puts its dynamic current back at its maximum when charging resumes. Observation 48 reads 32 A, as traced in #225. The driver re-sent its order through the settings endpoint, which "will only forward commands to device if new value != old value" (charger_setchargersetting). Since the cloud still stored our order, the re-send never reached the charger, and the 32 A stuck.

On a 3×16 A site a 7 A order drew 16 A (L2 at 24.2 A for about 10 s) until FTW's hard limit cut the charger to 0 A. The following resume drew 16 A again. That site's FTW logged about 15 fuse_over_limit notifications since 31 Oct, mostly at night.

This version re-sends the order as set_dynamic_charger_current with minutes: 0, which Easee documents as "a limit being applied until another one is set". A command always reaches the charger.

  • 3 s after a successful resume_charging (auto-resume or ev_resume) or start_charging, using the existing pending_amp_resend path.

  • The phaseMode re-assert now uses the command too, so the reset that path guards against is undone.

  • In driver_poll, when the charger reports a dynamic limit above the order, or draws more than 2 A over it, the order goes out as a command, at most every 10 s. This catches a reset whatever caused it.

  • A re-send that fails is retried every 10 s, not on every poll.

  • A 0 A order is re-sent as a 0 A command. That is the limit Easee's pause sets ("Limits dynamic charger current to 0", charger_pausesession).

  • When a lower order's settings write fails, re-sends use that lower order, not the earlier, higher one.

Normal orders still use the settings write, so the request rate does not change.

Driver evidence

  • Driver id: easee_cloud 1.4.1 → 1.4.2
  • Device make/model: Easee Home (EH…), maxChargerCurrent 16 A, phaseMode 3, Tesla Model 3
  • Firmware tested: as reported by Easee Cloud on 2026-11-14; not recorded
  • Protocol/register source: Easee Cloud API reference (links above), observation ids 48 (dynamic current) and 183 (current)
  • Hardware test performed: FTW v0.163.0-beta.1 on a Raspberry Pi with this driver, three FTW restarts with the car charging under a 12 A order:
    • The driver logged charger allows 32 A / draws 0.009 A over our 12 A order; re-sent it as a command, and the car settled at 12 A.
    • After a later restart the 3 s re-send landed first, and no 32 A was seen.
    • From 11:35 to 12:12 CET, across those restarts, pause/resume and orders between 8 and 12 A, there were no fuse_over_limit events.
    • Before this version, the same restart produced 16 A against a 7 A order twice.
    • From 14 to 16 Nov the poll check re-sent the order 20 times, 11 of them after the charger reported 32 A. No 32 A report repeated at the next check 10 s later.
    • Easee accepted all 12 of the driver's 0 A commands; none failed. Those after a phaseMode write went out with a pause, so the logs cannot tell whether the command or the pause set 0 A.
  • Known limits:
    • Easee documents the reset: resume_charging "Resets output current limit set in dynamic charger current" (charger_resumesession), as the traces in easee_cloud: trace dynamic current around phase mode changes #225 and this site show.
    • A command limit is cleared when the cable is unplugged or the charger reboots; the next order sets it again.
    • The 2 A draw margin allows for ramp-down after a lower order. A re-send within it is harmless.

Safety

  • The driver starts read-only, or this is a separately reviewed control change. This is a control change: it only re-sends the order Core gave, never more current.
  • Vendor signs are converted at the driver boundary. Unchanged.
  • Cached telemetry becomes stale instead of being re-emitted as fresh. Unchanged.
  • No credentials, serial numbers, private addresses or site data are included.

Control evidence

  • HIL evidence: above. Default mode is unchanged (pause, then 0 A via settings). No lease change.
  • Control changes include default-mode, lease-expiry and HIL evidence.

Overlap

Open PRs #200, #194, #189, #183, #172 and #159 also change easee_cloud.lua. None re-sends the limit as a command; #183's notes describe the same 32 A report "despite the 6 A offer and reassertion". This is based on main (1.4.1), so the version and CHANGELOG may need a rebase depending on merge order.

Checks

  • Commits include Signed-off-by.
  • make test-driver ID=easee_cloud: 43 passed, 15 skipped. The new test_easee_cloud_resend fails on 1.4.1 ("no 7 A command after a resume") and passes here. Its later cases fail without the follow-up commit: "retried a failed re-send within 10 s", and, without the failed-cut change, "a failed cut to 8 A re-sent 12 A".
  • make check: 5091 passed, 951 skipped.

Performance: normal polls do not change; at most one extra HTTP command per 10 s, and only while the charger exceeds the order. A failing re-send now costs one request per 10 s instead of one per poll. make test-driver ID=easee_cloud, three runs each on the same machine: 0.29–0.32 s before the follow-up, 0.29–0.30 s after.

🤖 Generated with Claude Code

https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp

Easee puts its dynamic current back at its maximum on a resume or a
phaseMode write (32 A reported, srcfl#225). The settings write only reaches the
charger when the cloud's stored value changes, so re-sending the same order
as a setting never undid it: a 7 A order drew 16 A on a 16 A fuse. The
driver now re-sends its order as a set_dynamic_charger_current command 3 s
after a resume or start, after a phaseMode write, and whenever the charger
reports a higher limit or draws over the order (at most every 10 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp
Signed-off-by: Erik <758402+erikarenhill@users.noreply.github.com>
@erikarenhill

Copy link
Copy Markdown
Author

@frahlg could you review this? It fixes the Easee 32 A reset after a resume from #225 (HIL evidence in the description). I can't request reviewers on this repo myself.

@frahlg frahlg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed, and make test-driver ID=easee_cloud passes (43 passed, 15 skipped; the new resend test fails on 1.4.1). Sending the order as set_dynamic_charger_current is the right answer to the 32 A reset in #225, and the hardware evidence is clear. Two things before merge:

  1. 0 A as a command. last_amps_set can be 0 after a pause or the default mode. ev_resume, the resend after a resume and the poll trigger would then send amps = 0 through the command endpoint. Easee does not document 0 there; if it is refused, the poll trigger logs a warning every 10 s. Please send only when last_amps_set > 0, or test and document 0.
  2. Unthrottled retry. pending_amp_resend is retried on every poll while the command endpoint errors. Please space the retries (for example with REASSERT_MS) and add a test where the command fails.

Lower, not blocking: after Core lowers an order, Easee's echo of observation 48 lags, so the trigger re-sends every 10 s until it catches up (harmless, a few extra commands while orders change); and a failed lowering write leaves last_amps_set at the earlier order, which a re-send would repeat.

Order: this should merge before #194. #194 then takes 1.4.3, and its poll fixtures need timestamp= on observation 120 for test_easee_cloud_resend.lua to pass with #194's stamped-power rule.

@frahlg frahlg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Claude's review, posted at Fredrik's request.

The fix looks right, and it matters: a 7 A order that draws 16 A on a 16 A fuse is a safety problem, and a settings write of an unchanged value cannot undo Easee's reset.

Before merge:

  • CI has not run on this PR. It comes from a fork, so the workflows wait for approval.
  • Six other open PRs change easee_cloud.lua (#159, #172, #183, #189, #194, #200), so the version and CHANGELOG need a rebase that depends on merge order.

Two questions:

  1. What does minutes: 0 mean to Easee? The description says the limit holds until the next one; the test's assert message says "command limit expires". If 0 means no expiry, the message should say so; if it means something else, the command needs another value.
  2. With a 0 A order (driver_default_mode sets last_amps_set = 0), a connected charger that reports a higher dynamic limit gets a 0 A command every 10 s until the limit reads 0. That is probably what we want, but a test line would pin it down.

After merge, Core's pinned driver bundle has to move for this to reach the boxes.

@miravoss26 miravoss26 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-sends the current limit as set_dynamic_charger_current (minutes: 0) 3 s after resume/start/phaseMode write, and whenever the charger allows more than ordered (+0.5 A) or draws more than 2 A over, at most every 10 s. Fixes the settings-endpoint no-op when the cloud's stored value equals our order (#225).

  • Version bumped consistently (lua, manifest, devices.yaml, index, CHANGELOG, support status). Tests added for the resend and start-boost paths. CI green.
  • now, dyn_current, connected and charging are all defined before the new block, and the 10 s throttle is stamped before the call, so a failing endpoint won't hammer Easee's API.
  • Question, not a blocker: minutes = 0 is described as hold until the next limit. Is that confirmed against Easee's docs or observed on a real charger? The fix depends on it.
  • Security: no new hosts, no secrets, error text goes through redact_http_err.

Safe to merge from my read, pending your answer on minutes = 0.

A re-send that fails after a resume or phaseMode write is now retried every
10 s, not on every poll. When a lower order's settings write fails, re-sends
use that lower order, not the earlier, higher one. A 0 A order still goes out
as a 0 A command: it is the limit Easee's pause sets, and Easee accepted
every 0 A command on a real charger. The code and test now quote Easee's
documentation for minutes = 0: the limit holds until the next one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp
Signed-off-by: Erik <758402+erikarenhill@users.noreply.github.com>
@erikarenhill
erikarenhill force-pushed the fix/easee-resend-limit-as-command branch from 66448d7 to 9e8205a Compare November 16, 2026 10:25
@erikarenhill

erikarenhill commented Nov 16, 2026 •

Copy link
Copy Markdown
Author

Thanks for the reviews. Addressed in 9e8205a. Still 1.4.2: main has not moved since 1.4.1, so the version stays whichever of the open Easee PRs merges first.

1. 0 A as a command. I took the "test and document 0" option. 0 A is the limit Easee's own pause sets: pause_charging "Limits dynamic charger current to 0" (charger_pausesession). The command's amps is an int32 with no documented lower bound. On the test site Easee accepted all 12 of the driver's 0 A commands between 14 and 16 Nov, some after a phaseMode write and the rest from the poll check; none failed. Case 7 of test_easee_cloud_resend.lua pins it down: at a 0 A order, a charger reporting 32 A gets one 0 A command, nothing again within 10 s, and nothing once it reads 0 A. If you'd rather not command 0 A at all, the guard is a one-line change.

2. Unthrottled retry. Fixed: a failed re-send is retried after REASSERT_MS (10 s), not on every poll. Case 6 makes the command endpoint fail; it fails on the first commit ("retried a failed re-send within 10 s").

Failed lowering write. Fixed as well: when the settings write of a lower order fails, last_amps_set takes the lower order, so a re-send never repeats the earlier, higher one. The poll check then sends the cut as a command, which also retries it. Case 8 fails without the change ("a failed cut to 8 A re-sent 12 A").

Echo lag after a lowering. Left as is. On the test site it costs one extra command per lowering. For example, charger allows 12 A / draws 12.0 A over our 6 A order appears once and is not repeated 10 s later.

minutes: 0. Easee documents it: "Setting minutes to 0, results in a limit being applied until another one is set" (charger_set_dynamic_charger_current). The test's assert message said "command limit expires", which was wrong; it now says the limit holds until the next one. Easee also documents the reset this PR works around: resume_charging "Resets output current limit set in dynamic charger current" (charger_resumesession). The description now cites both.

CI and order. No checks have reported on this fork PR, so the workflows probably need a maintainer's approval. Locally, make check passes (5091 passed, 951 skipped) and make test-driver ID=easee_cloud passes (43 passed, 15 skipped). Agreed on merging this before #194, which then takes 1.4.3 and needs timestamp= on observation 120 in the resend fixtures.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants