Skip to content

fix(history): retain estimated daily use across brief balance failures - #1668

Open
segran2 wants to merge 7 commits into
srcfl:masterfrom
segran2:fix/daily-history-balance-1667
Open

segran2 wants to merge 7 commits into
srcfl:masterfrom
segran2:fix/daily-history-balance-1667

Conversation

@segran2

@segran2 segran2 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem and result

Closes #1667.

A brief negative household-power residual currently makes load_wh unknown for the entire local day. Preserve the rejected instantaneous samples, but retain signed source-balance energy in a separate estimate table. Daily totals can use that evidence when its coverage exactly matches the affected energy rows; the API and History label the resulting household total as estimated.

Report recorded time alongside the requested period so actual offline/writer gaps remain visible. Negative daily totals and estimates exceeding both two minutes and 5% of recorded time remain unknown.

Scope and safety

Verification

  • Beta-based implementation: make verify, 727 web tests, targeted signed-balance/coverage regressions, ARM64 build, and runtime API verification passed.
  • On PR head a77dc66, based on current master: make verify passed (Go suites, protocol suites, vet and build), and all 727 web tests passed. The release Docker-context check was skipped because no Docker daemon is available. The History quality renderer test now includes the new recording-coverage helper. GitHub CI is still running.
  • Browser inspection of the deployed beta hotfix shows household bars for all four affected days, the estimate legend, recording-gap text, and the existing EV-cost cards. This is agent inspection; independent human UI review remains outstanding.

Checklist

  • One bounded household-history fix, linked to observed evidence.
  • Overlapping PRs identified; no reviewer or author was pinged.
  • Regression tests and a patch changeset included.
  • Independent human review of the rendered UI.
  • Commit carries a DCO sign-off.

@segran2

segran2 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Related EV regulation field test — 17 October 2026 (CEST)

Personal v0.145.2-beta.1 revision 4, derived from #1675 head 8a02c0a and preserving the existing EV-cost/history patches, was installed on the affected RPi. Its executable SHA-256 matches the package manifest; FTW restarted at 03:08:08.

A controlled test for #1674/#1675 observed 6.209 kW EV charging with a 7,500 W import cap (7.058 kW grid import), an intentional stop with a 3,000 W cap, and automatic recovery to 10.328 kW after disabling the cap, without a cable reconnect or manual Start/Resume. Follow-up at 03:16:49 reported Following and no further stop in that observation interval.

This verifies that bounded charging-control scenario, not the history fix. The test's history rows, invalid_balance occurrences, daily estimate provenance and recording coverage still need inspection, followed by a longer charging period. The earlier additive historical repair remains an estimate; this test does not recover missing measurements or establish that all asynchronous balance failures are prevented.

The import cap is now disabled because the user currently has no peak-tariff requirement. The configured 25 A per-phase main-fuse protection remains in place. Keep #1667/#1668 open pending history verification and review.

@segran2

segran2 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Longer field/history check — 17 October 2026, 12:27 CEST

The car now reports the requested 80% SoC (vehicle reading about 105 minutes old at inspection), and retained session delivery is approximately 42.73 kWh. Current command and actual charging are both zero; the command reason is no_plan_budget. The service has continued running since revision 4 installation. No exhausted-resume warning was found in the inspected post-test journal.

This is not a continuous, interruption-free charging result. At 05:49:15, with the import ceiling disabled, the controller issued a below-minimum zero offer: grid 12,323 W, eligible EV credit 0 W, phase bound approximately 2,449.5 W, minimum 4,140 W. Aggregated history shows EV zero from 05:49:25 through 05:50:25 and positive power again at 05:50:40 (10.230 kW by 05:50:45). This documents later recovery in telemetry; it does not independently establish whether any user action occurred or whether that zero decision was physically justified. Other short zero/low-power intervals also exist. The initial controlled test remains passed, but long-term stability and that later decision's raw alignment/phase evidence still need investigation.

History API review (range=12h&points=4320, 10-second aggregated rows):

  • 03:13:35–03:16:50, covering the controlled stop/restart: 20 returned rows, all complete.
  • 03:11–03:17, including the earlier rate reduction: 35 complete rows and one balance_mismatch / invalid_balance row.
  • 03:17–07:15: 1,428 returned rows, 14 with balance_mismatch, the remainder complete. These are aggregate rows, not counts of original failed measurements; averaged columns and last embedded driver values must not be treated as simultaneous raw samples.
  • The daily API still provides a non-null estimated household total for 17 October (15.268 kWh at this inspection), recorded coverage 44,855,239 ms against elapsed period 44,871,653 ms (about 16.4 seconds uncovered). 16 October remains estimated at 33.461 kWh with reported full-day coverage.

Thus #1668's deployed daily estimate is present while rejected instantaneous rows remain visible; live balance failures are not eliminated. This API inspection does not independently audit every estimate-table entry, exact missing interval or database provenance. No database repair or hardware/configuration change was made in this check.

@segran2
segran2 marked this pull request as ready for review October 17, 2026 12:57
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.

Brief measurement imbalances invalidate whole daily household totals

1 participant