Skip to content

fix(easee): retain session identity across pauses and preserve source times - #116

Merged
frahlg merged 4 commits into
mainfrom
fix/easee-observation-freshness-20260913
Sep 14, 2026
Merged

frahlg merged 4 commits into
mainfrom
fix/easee-observation-freshness-20260913

Conversation

@frahlg

@frahlg frahlg commented Sep 13, 2026

Copy link
Copy Markdown
Member

Easee keeps the same plugged-in session while FTW or the car pauses charging, even when its ongoing-session response contains sessionEnd. Treating that field as an unplug erased the battery estimate after restart. Keep the canonical session ID when the observation and ongoing session agree, and reject the old ID after an observed unplug.

Carry the vendor timestamps for power and session energy. Declare a bounded 180-second power reporting window so Core can estimate progress between source updates without refreshing their timestamps. Keep the independent driver watchdog unchanged.

Paired Core integration: srcfl/ftw#1240 (pins this driver commit). Addresses srcfl/ftw#1235 and srcfl/ftw#1236.

Validation: make check passed (4,404 passed, 1,069 skipped), including session-proof, paused-session, stale-data and unplug cases. A physical Easee charge ran at about 7.1 kW, reached the configured target estimate and stopped at measured 0 W. The same verified session retained its estimate across Core restarts. This is a local candidate; the signed channel has not been released.

Review follow-up: invalidate cached proof across offline or unreadable observations, then verify it again after reconnect. Spread failed lookups across the hour so paused retries leave capacity for charging. New regressions cover both cases; full make check and Core integration tests pass. Tracked in srcfl/ftw#1241 and srcfl/ftw#1242.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T14:58:10.119166Z 8e8b48f 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e8b48f604

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread drivers/lua/easee_cloud.lua Outdated
if type(mode) ~= "number" or mode < 0 or mode > 6 or mode % 1 ~= 0 then
return nil, "missing charger state"
end
if mode == 0 then return nil, "charger offline; connection unknown" end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Invalidate session proof while suppressing offline samples

When session A has already been validated and the charger goes offline, this early return prevents current_session_id(0) from clearing that proof. If A is unplugged or replaced during the outage and Easee initially reconnects in mode 2/6 while observation 223 still contains historical A—as the surrounding logic explicitly allows—validated_session_id == identity emits A without revalidation, causing Core to restore the previous vehicle's battery estimate. Suppress the offline telemetry, but invalidate the cached proof before returning so reconnect cannot present stale session identity as current.

AGENTS.md reference: AGENTS.md:L77-L77

Useful? React with 👍 / 👎.

Comment on lines +351 to +352
-- A pause is still an open session. Ask the ongoing-session endpoint
-- before restoring its identity; observation 223 alone may be historical.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve lookup quota until charging can verify the session

Because modes 2, 4, and 6 now enter this lookup path unconditionally, a driver that boots while paused with temporarily mismatched observation and /sessions/ongoing data retries once per minute and consumes all ten hourly requests in about nine minutes. If charging then starts after the tenth attempt, the existing #recent >= 10 guard prevents session verification for roughly another 50 minutes, so Core receives no session identity for most or all of that charge. Spread retries across the hour or reserve an attempt for a transition to active charging.

Useful? React with 👍 / 👎.

Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@frahlg
frahlg merged commit 07d408a into main Sep 14, 2026
6 checks passed
@frahlg
frahlg deleted the fix/easee-observation-freshness-20260913 branch September 14, 2026 03:51
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