Repository navigation
fix(history): book an Easee charger's energy from measured power - #1988
Merged
Merged
Conversation
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>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_whin 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 asinvalid/counter_jump. Across 30–31 October the record held 16.6 kWh against about 32.7 kWh of power.Change
chargerEnergyCounterleaves out a session counter when the driver setssession_wh_coarse, so the ledger integrates power. A real lifetime counter beside it would still be used. A charger without the flag is untouched.easee_cloud1.4.1, the only driver that changes).session_whitself 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:
TestChargerEnergyCounterandTestCoarseChargerIsBookedFromPower(2 s readings, 1 kWh steps, 10 kW for an hour: 10,000 Wh, no rejected reading).make driver-versions-across-pinpasses.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