Skip to content

fix(telemetry): derive Home use from energy and preserve history gaps - #1720

Merged
frahlg merged 4 commits into
masterfrom
codex/home-use-alignment
Oct 18, 2026
Merged

frahlg merged 4 commits into
masterfrom
codex/home-use-alignment

Conversation

@frahlg

@frahlg frahlg commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Problem and result

Refs #1667. Builds on #1668, now merged as 5c2ec4e9. Rebased onto master 4223a25f after #1719 and #1721 merged. Review this change alone.

A slow charger report can make the latest household power balance negative. Filtering each device does not align their times. Home use now shows a marked interval mean: subtract charger session-energy differences from the other flows' integrated energy over the same reported period, then divide by the period's length. Use sampled power for sources without timed counters. A broken counter series waits for a new valid interval. A minute-scale report produces a slower, older mean rather than a claimed live reading.

The house shows ≈, with the period's clock times, time zone, length and age since its end below the diagram. A past mean cannot supply SELF-POWERED NOW. Raw load_w, quality and control evidence remain separate. Missing coverage shows unknown rather than falling back to the latest mismatched residual.

Easee checks

Checked the release's exact driver pin, 5cc7bb1a65fe41c4f2cb28a7f546875313b2df85, also used by v0.150.0-beta.1:

  • Easee defines observation 121 as accumulated session energy in kWh. The driver converts it to session_wh, retains that observation's own energy_observed_at, and supplies a session id checked against the ongoing-session endpoint. The new calculation uses those existing fields and adds no API calls.
  • Get Observations returns last reported observations. I found no documented fixed cadence for observation 121. The implementation follows distinct source timestamps and observed interval coverage; it does not assume that the poll interval or time since the last value change is a measurement schedule.
  • Lifetime-energy reports normally update hourly. They are not the source for this minute-scale session calculation. No reporting configuration was changed.
  • The supplied capture arrived on 17 October at 23:58:55 CEST, with TotalPower 6.768 kW at 23:57:05 CEST. Its 110-second timestamp age is not proof of transport delay. That capture does not contain observation 121, so it cannot establish the real session-counter cadence. No new device capture was made.
  • Pixii has separate Modbus reads/emits and no power source time. Local receipt times remain estimates of sampling time. Do not combine its cabinet DC-energy counters with the AC power used in the site balance. Cached local energy registers also need their own observation time before they can serve as counter evidence.

Calculation and limits

  • Prefer monotone session-energy observations with a source timestamp and the same nonempty session id. Session changes, resets, malformed/missing values or times, conflicting/backward/future timestamps, offline transitions and driver replacement break the series. Repeated cloud replies add neither energy nor measurement time.
  • Start with ten seconds and widen to cover at least the largest of each source's last three distinct report intervals. Keep whole intervals from the slowest charger counter. With several counter clocks, estimate interior boundaries by linear cumulative-energy interpolation. This estimates allocation within an interval; it does not prove constant power.
  • Integrate other sources with time weights over exactly that reported period. Power gaps over 30 seconds remain unsupported. Counter gaps and display periods over five minutes remain unsupported. Keep bounded buffers for up to eight minutes of coverage and require the period to end within three minutes. These are display limits, not measured vendor latency or guarantees of cadence.
  • Return signed household Wh divided by elapsed hours. Reject negative/non-finite balances. Counters do not establish instantaneous min/max power, so omit that range when counters contribute. The API retains mean age separately from the explicit end age shown in the UI. Device clock offsets and sampling delays remain unverified.

History and scope

Keep #1668's signed balance-energy record. Publish new daily estimate evidence only after a balance episode recovers within two minutes without a recording gap over 15 seconds. Long or interrupted failures stay unknown. Do not clip negatives or fill from surrounding positive endpoints. The new display intervals are not added to history totals, which would count energy twice.

Break history integration at restart, keep SoC quality separate from power coverage, and wait three minutes after local midnight before caching the closed day. Estimated daily load stays out of measured, gets ≈ in Today, and supplies no measured self-powered share. Display smoothing keeps Core's raw household residual, including V2X, instead of deriving it again from independently filtered fields.

No change to forecast training, fuse protection, dispatch, charging commands/limits or recovery. No box operation, database repair, backfill, driver pin, merge or release. Checked open work and reviews: #1668 owns the base; #1547 stays untouched. #1719/#1694/#1675 have separate app.js work. #1177's visibility-pause changes already appear in this base; this patch does not alter that path. No reviewer was requested.

Verification

  • make verify: passed (Go/protocol tests, Docker context, native solver handshake, package/migration checks, boundaries, vet and build).
  • npm test: 767 passed.
  • Energy regressions: minute-delayed energy with old power, changing 60/120-second report intervals, repeats ageing out, reset/session/clock failures, local gaps, whole counter periods, two charger schedules, AC/DC separation and driver replacement. API and UI tests keep raw power separate and prevent a live self-powered share from using a past mean.
  • Existing reported-time regressions cover a known one-minute power delay and missing source time. The synthetic known-four-second-delay replay still compares the reported common window with independent existing scalar Kalman filters: 0 W versus 1380.5 W mean absolute error. This is not a calibrated full-state fusion comparison or the missing raw 19:32 trace.
  • Existing history replays cover signed Wh, bounded recovery, long failures, restart, missing SoC and local midnight; API tests include DST boundaries.
  • Browser: compared the previous commit with the changed actual Flow component and dashboard render function in a local synthetic fixture. Inspected desktop and 390 px mobile, 60/120-second means, a period crossing local midnight, unavailable and paused states. Confirmed ≈, time zone/end age, no SELF-POWERED NOW for past means, and no horizontal overflow.
  • The first full run hit an OCPP test's listener-start timeout. That test passed three isolated reruns. The final complete rerun is reported above.

Remaining evidence

Independent human UI review and physical-site validation remain open. Measure observation 121's actual updates and reset/session binding, paired source/receipt times, device clock offsets and independent energy over the same intervals. An old change-only observation may still leave Home use unavailable; a successful cloud poll cannot make it fresh.

Beta integration check

The owner authorized merging the selected fixes and publishing the next beta. Head 67ef0966 has the same Git tree (6575c8db) as the isolated combination of #1668, #1719, #1720 and #1721 that passed full make verify and all 781 web tests. The rebased head is running its own CI before merge. Human UI and physical-site checks remain part of beta validation.

@frahlg frahlg changed the title fix(history): align Home use estimates and preserve gaps fix(history): qualify Home use timing and preserve gaps Oct 18, 2026
@frahlg frahlg changed the title fix(history): qualify Home use timing and preserve gaps fix(telemetry): derive Home use from energy and preserve history gaps Oct 18, 2026

frahlg commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

Integration check with the charging candidate passed on 18 October. An isolated tree combines #1719 e89f27a2 (including master 2dde2463) with this PR at 78674490, including #1668 5d1af9b. Git reports no conflicts, full make verify passes, and all 775 web tests pass.

Keep the existing merge order: #1668 first, then rebase this PR. No branch, box or release was changed by the check. Home use uses timed energy/period evidence; the EV safety guard remains meter-based and does not consume the estimate. Independent human UI and physical report-cadence validation remain outstanding.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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-10-18T06:34:10.938110Z 7867449 Draft marked ready
ℹ️ 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.

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 force-pushed the codex/home-use-alignment branch from 7867449 to 67ef096 Compare October 18, 2026 06:31
@frahlg
frahlg merged commit 32a35a2 into master Oct 18, 2026
22 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