Skip to content

fix(history): book an Easee charger's energy from measured power - #1988

Merged
frahlg merged 1 commit into
masterfrom
fix/easee-counter-energy
Nov 8, 2026
Merged

frahlg merged 1 commit into
masterfrom
fix/easee-counter-energy

Conversation

@frahlg

@frahlg frahlg commented Nov 8, 2026

Copy link
Copy Markdown
Member

Problem

On 8 November 2026 an Easee charger delivered 24.3 kWh and the box's energy record kept 10. #1547's cost panel then showed "Today 10 kWh · SEK 39.25".

Easee moves session_wh in steps of about 1 kWh. The ledger uses it as a cumulative counter and judges each step against the time since the last reading, so with readings seconds apart a step looks impossible and is dropped as invalid/counter_jump. Across 30–31 October the record held 16.6 kWh against about 32.7 kWh of power.

Change

session_wh itself stays for the car's level and notices. Past days keep their old totals; the record cannot get back what it dropped.

Evidence

Measured power against Easee's own session total on the owner's box:

Charge Easee Power integrated
25 Oct 6.6 kWh 6.59 kWh
31 Oct 31.7 kWh 31.68 kWh
8 Nov 24.3 kWh 24.27 kWh
  • New tests: TestChargerEnergyCounter and TestCoarseChargerIsBookedFromPower (2 s readings, 1 kWh steps, 10 kW for an hour: 10,000 Wh, no rejected reading).
  • make driver-versions-across-pin passes.

Review

An independent review (Sonnet) found nothing that blocks: no double count on upgrade, and a rollback re-baselines. One accepted cost: an outage of more than two minutes during a charge now loses that energy, where the counter used to recover it. Easee reports every 2–10 s, so it takes a driver or cloud outage that long.

🤖 Generated with Claude Code

Easee moves session energy in steps of about 1 kWh. The ledger judged each
step against the time since the last reading, so a step seconds after one
looked impossible and was dropped. One charge recorded 10 of 24.3 kWh.

A driver can now say its session counter is coarse, and the record then
integrates power. Moves the driver pin to easee_cloud 1.4.1.

Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T14:11:38.988218Z 62addda 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.

@frahlg
frahlg merged commit 4a8e509 into master Nov 8, 2026
22 of 23 checks passed
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