Repository navigation
fix(easee): always start sessions at 6 A to avoid 16 A inrush - #210
erikarenhill wants to merge 2 commits into
Conversation
Easee's cloud caches dynamicChargerCurrent server-side and resets it to
maxChargerCurrent (16 A on a typical install) on phaseMode changes and
some session-start paths. A freshly plugged-in EV would therefore pull
fuse-rated current for 5-10 s before the controller's first dispatch
tick clawed it back, visible at the meter as a power surge.
Floor the cached setpoint at the hardware minimum (6 A) in two places:
- driver_init: prime once after auth + serial resolve, so the very
first session a user starts begins at 6 A.
- ev_start: re-floor right before POST /commands/start_charging so
the cable energises at the minimum even if a phaseMode reset just
bumped the cached value back to maxChargerCurrent.
Both writes update last_amps_set so the post-phaseMode resend logic
(pending_amp_resend) doesn't race the floor back up. The controller's
5 s ev_set_current tick then ramps from 6 A to the dispatched target
on its own schedule.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR updates the Easee Cloud Lua driver to proactively set dynamicChargerCurrent to the Easee hardware minimum (6 A) so that new charging sessions don’t briefly start at the cached server-side value (often 16 A) before the controller’s first current-dispatch tick.
Changes:
- Prime
dynamicChargerCurrenttoEASEE_MIN_Aduringdriver_initafter auth + serial resolution (and log success/failure). - Re-floor
dynamicChargerCurrenttoEASEE_MIN_Aimmediately beforePOST /commands/start_chargingin theev_startcommand path. - Update
last_amps_seton successful floor writes to align with the existing post-phaseMode resend logic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| end | ||
|
|
||
| -- Force a 6 A resting setpoint so any session that starts before our | ||
| -- first ev_set_current tick lands begins at the hardware minimum, not |
There was a problem hiding this comment.
Grammar in this comment is a bit confusing: “so any session that starts before our first ev_set_current tick lands begins …”. Consider rewording (e.g., remove either “lands” or “begins”) so the sentence reads cleanly.
| -- first ev_set_current tick lands begins at the hardware minimum, not | |
| -- first ev_set_current tick arrives begins at the hardware minimum, not |
|
Approve in principle — both 6 A writes (driver_init post-auth, and ev_start pre-/commands/start_charging) are the right defense against the 16 A inrush, and the warn-only logging keeps the controller's 5 s Could you rebase onto current master? PR shows CONFLICTING — likely overlap with the firmware-settings probe block that landed. After that I'll merge. |
|
Friendly bump @erikarenhill — master has moved a fair bit since this PR was opened (recent fuse-guard / dispatch refactors in #335 / #342 / #353). The change here is tight and self-contained, so a rebase should be mechanical. Mind force-pushing once it's clean? Happy to merge as soon as CI goes green on the rebased head. |
Summary
dynamicChargerCurrentand resets it tomaxChargerCurrent(typically 16 A) on phaseMode changes and some session-start paths. A freshly plugged-in EV therefore pulls fuse-rated current for 5–10 s before the controller's first dispatch tick claws it back — visible at the meter as a power surge.Changes
drivers/easee_cloud.lua:driver_init— primesdynamicChargerCurrent = 6once auth + serial are resolved, so the very first session a user starts begins at 6 A regardless of what was cached server-side.ev_start— re-floors to 6 A immediately beforePOST /commands/start_charging, so the cable energises at the minimum even when a phaseMode reset just bumped the cached value back tomaxChargerCurrent.Both writes update
last_amps_setso the post-phaseMode resend logic (pending_amp_resend) doesn't race the floor back up. The controller's 5 sev_set_currenttick ramps from 6 A toward the dispatched target on its own schedule — no behaviour change above the driver layer.Not addressed (separate concern)
The phaseMode-change reset window (~5–10 s where Easee pins
dynamicChargerCurrent = maxChargerCurrentregardless of what we write) is unchanged. Capping that window at 6 A would require a temporarymaxChargerCurrent = 6write around phase flips, which is more invasive — worth its own PR if the operator still sees a flip-time surge.Test plan
Easee: dynamicChargerCurrent primed to 6 A at initshould appear.ev_startvia the dispatch path: cable should energise at 6 A before the next 5 s controller tick raises it.phaseModeinstalls aren't broken (init prime write should succeed even when phaseMode writes are silently rejected).🤖 Generated with Claude Code