Skip to content

fix(easee): always start sessions at 6 A to avoid 16 A inrush - #210

Closed
erikarenhill wants to merge 2 commits into
masterfrom
fix-easee-start-at-6a
Closed

erikarenhill wants to merge 2 commits into
masterfrom
fix-easee-start-at-6a

Conversation

@erikarenhill

Copy link
Copy Markdown
Collaborator

Summary

  • Easee's cloud caches dynamicChargerCurrent and resets it to maxChargerCurrent (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.
  • This PR floors the cached server-side setpoint to the Easee hardware minimum (6 A) in two places so every session starts at 6 A and ramps up from there.

Changes

drivers/easee_cloud.lua:

  • driver_init — primes dynamicChargerCurrent = 6 once 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 before POST /commands/start_charging, so the cable energises at the minimum even when 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 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 = maxChargerCurrent regardless of what we write) is unchanged. Capping that window at 6 A would require a temporary maxChargerCurrent = 6 write around phase flips, which is more invasive — worth its own PR if the operator still sees a flip-time surge.

Test plan

  • Plug in EV with charger fresh-booted: meter should show ramp from ~1.4 kW (6 A × 230 V) up to dispatched target, not a 3.7 kW spike.
  • Restart the forty-two-watts service mid-session: log line Easee: dynamicChargerCurrent primed to 6 A at init should appear.
  • Trigger an ev_start via the dispatch path: cable should energise at 6 A before the next 5 s controller tick raises it.
  • Verify firmware-locked phaseMode installs aren't broken (init prime write should succeed even when phaseMode writes are silently rejected).

🤖 Generated with Claude Code

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]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 dynamicChargerCurrent to EASEE_MIN_A during driver_init after auth + serial resolution (and log success/failure).
  • Re-floor dynamicChargerCurrent to EASEE_MIN_A immediately before POST /commands/start_charging in the ev_start command path.
  • Update last_amps_set on 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.

Comment thread drivers/easee_cloud.lua
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

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
-- first ev_set_current tick lands begins at the hardware minimum, not
-- first ev_set_current tick arrives begins at the hardware minimum, not

Copilot uses AI. Check for mistakes.
@frahlg

frahlg commented May 26, 2026

Copy link
Copy Markdown
Member

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 ev_set_current tick as the actual safety floor. The phaseMode-reset window caveat is correctly scoped out (max_charger_current config knob mitigates separately).

Could you rebase onto current master? PR shows CONFLICTING — likely overlap with the firmware-settings probe block that landed. After that I'll merge.

@frahlg

frahlg commented May 27, 2026

Copy link
Copy Markdown
Member

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.

@frahlg
frahlg deleted the fix-easee-start-at-6a branch November 11, 2026 09:17
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