Skip to content

fix(history): say EV cost is partial when a counter reading was rejected - #1987

Merged
frahlg merged 2 commits into
masterfrom
fix/ev-cost-counter-gaps
Nov 8, 2026
Merged

frahlg merged 2 commits into
masterfrom
fix/ev-cost-counter-gaps

Conversation

@frahlg

@frahlg frahlg commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Problem

#1547 added EV charging energy and cost to History. On the owner's home box on 8 November 2026 the charger delivered 24.27 kWh by its power readings (the box's own session notice said 24.3 kWh), and the panel said "Today 10 kWh · SEK 39.25" with no warning.

The Easee counter jumped during that charge and the ledger rejected those buckets (invalid, counter_jump), so each holds 0 Wh. The panel checks quality only for buckets with energy, so the low total read as complete. The PR promised that missing data during recorded charging marks the total incomplete.

Change

A bucket with invalid quality marks the period "Partial cost", even with 0 Wh.

A reset does not: a session counter restarts at every new session, and the energy comes back as its own integrated row. A gap at 0 Wh stays complete, as #1547 chose. Mostly the charger did not run, though a box offline during a charge looks the same; this panel cannot tell them apart.

This only makes the panel honest. The total stays low until the counter jumps themselves are fixed.

Evidence

  • node --test web/energy-history-integration.test.mjs passes, with a new test for a rejected reading, one outside the period, a counter reset and a gap. npm test: all web tests pass.
  • The numbers come from the home box's /api/energy/history, /api/prices and /api/series, read only. Before this change the panel on those readings showed 10 kWh and SEK 39.25 with no warning.

An independent review (Sonnet) read the ledger's qualities; dropping reset from the check came from it.

🤖 Generated with Claude Code

On 8 November 2026 a home charged 24.3 kWh and the new panel said 10 kWh
with no warning: the charger's counter jumped, the ledger rejected those
buckets, and each held 0 Wh. Only buckets with energy were checked for
quality, so the total read as complete.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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-08T13:23:30.307850Z a984823 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.

A counter restarts at every session and its energy returns as an
integrated row, so a reset would flag every period.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@frahlg
frahlg merged commit 68d05a6 into master Nov 8, 2026
17 checks passed
@frahlg
frahlg deleted the fix/ev-cost-counter-gaps branch November 11, 2026 09:19
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