Skip to content

fix(easee_cloud): stop reporting an old change time for steady power - #131

Merged
frahlg merged 1 commit into
mainfrom
fix/easee-power-confirmed-at
Sep 25, 2026
Merged

frahlg merged 1 commit into
mainfrom
fix/easee-power-confirmed-at

Conversation

@frahlg

@frahlg frahlg commented Sep 25, 2026

Copy link
Copy Markdown
Member

Problem

Easee records an observation only when its value changes. easee_cloud.lua passed observation 120's timestamp (TotalPower) as power_observed_at. So while a car charged at a steady current, the reported power looked older and older, although every 5-second poll confirmed it. The old comment assumed updates at least every two minutes; the owner's box showed power unchanged for up to 5.5 minutes.

FTW treats a non-zero power reading older than power_max_age_s (180 s) as stale, and until srcfl/ftw#1417 it stood the charger down to 0 A. On the owner's home box (Tesla, Easee Home) that produced 31 stops overnight; 23 of them came 170–190 s after the last power change.

Change (easee_cloud 1.3.2 → 1.3.3)

  • Unchanged value: when TotalPower is unchanged since the previous poll, the driver omits power_observed_at. FTW then stamps the reading when it arrives (ev_observation.go: PowerAt = r.UpdatedAt when the field is absent).
  • New value: still carries Easee's source time, so energy accounting keeps the moment the power changed.
  • Offline charger: op_mode 0 still makes get_observations fail, and the driver emits no sample.
  • No clock arithmetic in Lua: the 32-bit harness (LUA_32BITS) cannot hold epoch milliseconds exactly. A first attempt that formatted host.millis() as ISO time was 42 s off there.
  • Also updated: the manifest, index, devices and support status are regenerated by make check, and there is a CHANGELOG entry.

This changes telemetry timing, not control commands.

Tests

  • New drivers/tests/lua_harness/test_easee_cloud_power_time.lua, run by test_easee_cloud_power_time.py:
    • a new value keeps its source time;
    • an unchanged value omits it;
    • a changed value carries the new time;
    • an offline charger emits no sample.
  • test_easee_cloud_session.lua: unchanged and passing. Its assertion on the first poll's source time still holds.
  • make test-driver ID=easee_cloud: 38 passed.
  • make check: passes, with 88 manifests checked and 0 errors.

FTW needs a pin move afterwards to bundle 1.3.3.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 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-25T04:47:18.767773Z b4d4d18 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.

Easee records TotalPower (observation 120) only when it changes. The
driver passed that timestamp as power_observed_at, so a car charging at
a steady current reported power that looked older and older although
every 5 s poll confirmed it. FTW treats a non-zero reading older than
power_max_age_s (180 s) as stale; on the owner's box it stood the
charger down about every three minutes all night (srcfl/ftw#1417).

An unchanged value now omits power_observed_at, so the host stamps the
reading when it arrives. A new value keeps Easee's source time, and an
offline charger still emits no sample. No clock arithmetic: the 32-bit
Lua harness cannot hold epoch milliseconds exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@frahlg
frahlg force-pushed the fix/easee-power-confirmed-at branch from b4d4d18 to d0ea619 Compare September 25, 2026 04:46
@frahlg
frahlg merged commit 489c937 into main Sep 25, 2026
6 checks passed
@frahlg
frahlg deleted the fix/easee-power-confirmed-at branch September 25, 2026 04:47
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