Repository navigation
fix(web): the overview names a device that does not answer - #2097
Merged
Merged
Conversation
With one driver on a wrong port the overview showed a green LIVE beside empty circles and said nothing. LIVE now follows the two freshness facts the apps use: the box answers this page, and every configured device answers. Core grades each driver with the apps' own source-state ladder and sends it on /api/status as src_state, with last_ok_age_ms; the app link builds its source rows with the same function. The overview names each device that does not answer, says what Core knows, and links to Settings -> Devices. The savings card names its baseline, "no solar or battery": that number counts what the panels bring. Core sends the self-use baseline only from the energy ledger, which a box in source-history mode never reads, so a chosen self-use comparison now falls back to the named baseline instead of a false zero. "Unknown" energy is neutral, not red, and Get help says to ask in the FTW Discord with the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
A vehicle driver after a restart with the car away never answers, so the overview said "<car> has never answered" and LIVE stayed dark for the whole house until the car came home. Core now marks a driver that only reads a car vehicle_only on /api/status: its catalog entry declares the vehicle capability and nothing else, or, without an entry, it has only vehicle readings. The overview counts such a driver only when it reports an error, did not start, or has a device fault. The app link rows do not change. When /api/status carries price_area_note (#2100, for a box with no price area), the overview's price card shows it as one quiet line that opens Settings -> Price. Without the field nothing shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
frahlg
force-pushed
the
onboarding-overview-first-day
branch
from
November 28, 2026 05:57
c1e2c50 to
aba7f0d
Compare
frahlg
marked this pull request as ready for review
November 28, 2026 06:12
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
The onboarding review of 27 November (row 2, overview part, and row 13) found:
ok, turnsdegradedafter three failed polls andofflineafter the 60 s watchdog. The overview read none of it; only the status bar at the foot of the page showed a hollow mark.Change
Freshness, as the apps grade it.
appproto.DriverSourceandDriverSourceStatebuild and grade a driver's source row with the existing ladder (live,lagging,stale,down,neverfromregistry.yaml). The app link now builds its rows with the same function; the rows it sends do not change./api/statussends each driver'ssrc_stateandlast_ok_age_ms; a configured driver that did not start getsnever. The page and the apps now call the same device live. No wire, registry or client change.LIVE pill. Green only when this page's poll answers (the carrier) and every enabled driver's
src_stateislive. Otherwise a hollow ring and "Not live". "Connection lost" stays red.Devices that do not answer. A card under the heading names each one, with the driver's last error on a second line and "Check devices", which opens Settings → Devices:
<name> has never answered<name> has not answered for 4 min<name> did not start<name> answers but cannot act(device fault while reads still succeed)Nothing is named before a driver's first poll ends, and a
laggingreading darkens LIVE without naming anyone, as on the iPhone.A car away does not count. After a restart with the car away, a vehicle driver never answers. Without this rule the overview said " has never answered" and LIVE stayed dark until the car came home. Core now marks a driver
vehicle_onlyon/api/statuswhen its own catalog entry declares thevehiclecapability and nothing else, the signal the cars wiring already reads. A driver with no catalog entry gets the mark when its only readings are vehicle readings. The overview counts avehicle_onlydriver only when it reports an error, did not start, or has a device fault. The app link rows do not change.Price area note. When
/api/statuscarriesprice_area_note(#2100, for a box with no price area), the overview's price card shows it as one quiet line that opens Settings → Price. Without the field nothing shows, so this works before or after #2100 merges.Savings. The card says "Compared to no solar or battery". See below.
Unknown.
.is-unknowngives "Unknown" energy the muted colour on the overview and Energy tiles.Get help. One line under the More actions: "Ask in the FTW Discord and attach the file", linking https://discord.gg/UK2ygPBu8N.
Savings: what Core computes, and what a fair baseline needs
Core has a self-use counterfactual:
savings.EvaluateLedgerruns the same solar and battery without prices. It stores surplus, covers the house, keeps a reserve and loses a little in conversion. But only the energy-ledger path runs it.state.LedgerFlowBucketsreturns nothing once the box has a history source cursor, and every box writes that cursor on its first committed tick. So every current box takes the point-log path, which has only the no-solar baseline. On a fresh Core here,/api/savings/dailyhad noself_consumption_*fields and nobaselineslist.So the card names what it compares against: buying all use from the grid, a car's energy at the day's average price ("no solar or battery"). The Settings → System box "Compare with a plain self-use battery" used to show
+0.00on such a box (a sum of missing fields). Now it falls back to the named baseline, and uses self-use only when the box sends it for every day.A fair baseline, "the same home under ordinary self-consumption control", needs:
Evidence
npm test: 992 pass, 0 fail. New:web/overview-freshness.test.mjs, savings baseline cases inweb/components/savings-periods.test.mjs,.is-unknowninweb/energy-today.test.mjs.go test ./internal/api ./internal/appproto(whole packages) andgo test ./cmd/ftw -run 'App|Source|Snapshot|Car|Vehicle': ok. New:TestDriverSourceStateFollowsTheLadder,TestDriverSourceRowMatchesDriverSourceState,TestHandleStatusGradesEachDriverAsTheAppsDo(a wrong-port driver whosestatusstill saysokgetssrc_state: never),TestHandleStatusMarksACarAwayAfterRestartAsVehicleOnly(car driver offline and never answered getsvehicle_only; a charger does not).price_area_notepresent or absent, inweb/overview-freshness.test.mjs.make verify(niced,GOFLAGS=-p=3): clean, including./cmd/ftw(app link) and./internal/api.sim-ferroamp(site meter) andsim-sungrow. I took headless Chrome screenshots at 1280×900 and 390×844, before (master) and after:/api/statusshowedstatus: ok, src_state: neverin the first seconds andstatus: offline, src_state: neverafter the watchdog;Not tested
Open questions for Fredrik
ftw.savings.baseline), or have Core compute self-use as above?go/internal/drivers/host.go).Overlap
web/app.jsandweb/index.htmlin other hunks. A trial merge gives the same two conflicts it already has with master (script tags inindex.html,plan-brief.js); this branch adds none.ftw-energy-flow.js(fix(web): charts and readouts show a size and a word, never a raw minus #1862's file) and is unchanged here.25xcBzQaux); that file is outside this piece.🤖 Generated with Claude Code