Repository navigation
Conversation
Since #1741 any unknown time made the whole day's load_wh null. Before source history a day summed what it had, and nobody missed a number. A period now keeps its Home use, marked EstimatedLoad, when at most 1 % of its time is unknown. The total is the sum of the fully known source intervals; unknown time counts as nothing, so the number never changes, only whether it is shown. A negative known total stays unknown. Other flows keep their own unknowns. A replaced meter no longer hides the day either: each meter measured its own time and only the snapshot interval between them is unknown, so the bridge test's meter-replaced case now expects an estimate. Closed days are cached. A one-time history migration deletes cached days from the source cutover on, so days closed under the stricter rule are recounted. Relates to #1750. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
Member
Author
|
Superseded by #1753. Its rewrite (17bdaf7, 85100d6) keeps a day's Home use unless a flow is unknown or unrecorded for more than 10 % of the range, and recounts cached source days once ( |
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.
Superseded. #1753 was rewritten after Fredrik's two-layer direction (17bdaf7). It now has its own day rule, where a flow becomes unknown only after more than 10 % of the range, and a one-time recount of cached source days (
refreshSourceDayCache). Both parts of this PR are covered there, and the branch sits on the old #1753. Kept open only until Fredrik decides to close it.Stacked on #1753 (base
1750-bridge-short-history-gaps), next to #1755. Relates to #1750.Fredrik's choice in #1755: relax the day rule. Physics rules do nothing for a site without a map pin, and they cover one cause at a time.
Problem
Since #1741 (18 October), any unknown time makes the whole day's
load_whnull: one unknown minute, a 3-minute restart, a battery that drops out for 3 minutes. Before #1741 a day summed what it had and never asked for full coverage, so nobody saw a gap. #1753 and #1755 handle two causes. Every other cause still nulls the day.Change
EstimatedLoad. Unknown time counts as nothing. Core already computed this number; only whether it is shown changes. The Home Assistant bridge, which reads the number whether it is known or not, sees no change.pv_wh, battery and grid totals stay null for their own gaps.history_qualitymay then readincompletewhileload_whhas a number; each field already carries its own null.home-use-unknown-share-v1, deletes cached days from the source cutover on, so days such as 18 and 19 October are recounted after the update. Days before source history are not touched.No new setting, table, API field or UI.
Evidence
TestHomeUseSurvivesSmallUnknownShare: six hours of a 1000 W house at 10 s, one disturbance three hours in. 1 % of six hours is 3.6 minutes.TestSourceDaysAreRecountedOnce: a cached source day is deleted on open, a day before source history stays, and a later cache entry survives the next open.Each test fails when its part is switched off: no relaxation (both 5950 Wh cases stay null), no negative guard (the negative case becomes known), no recount (the cached day stays), recount every open (the second open fails).
70-day simulation: the soak used for #1753, #1754 and #1755, seed 42, 5 s ticks, Stockholm time. Each day has restarts, a night PV gap of 30–300 s, a day PV gap of 30–120 s, EV, meter and battery gaps; one day has a 12-minute outage. Days are 19–24 kWh.
The one null day has the 12-minute outage plus a battery gap, together over 1 %. The larger mean error is the unknown time counted as nothing, about 0.2 % of a day. #1755 still helps: night PV gaps then add no shortfall.
make verify: passed on this branch (on #1753). All 77 Go packages, protocol and script tests, vet and build. Nothing skipped.go test ./internal/state ./cmd/ftwalso passes with #1753, #1754, #1755 and this PR merged together.Not verified
For Fredrik to decide
pv_whand battery totals. Left out here: Repair historical Home use gaps from retained source measurements #1750 asks that rebuilding Home use must not make another flow known.🤖 Generated with Claude Code