Repository navigation
feat(gridstate): the site's grid state from the inverters - #2132
Merged
Merged
Conversation
A hybrid inverter's driver reports grid_state on its inverter stream, read from an explicit vendor status in the same poll (device-drivers #285); Core had nowhere to read it. The inverter reading now parses it, "on_grid" or "off_grid" and nothing else, and package gridstate folds the fresh reports into the site's state every control tick: off grid once a report has said so for 30 s, since FoxESS opens its relay for 9-20 s on its own checks with the grid there; back on grid once every report has said so for a minute; unknown with no report under 30 s old, which keeps every behaviour as before. A state is dated from the first report. An islanding FoxESS raises a device fault (39067 = 0x0980), which hides its reading from LiveInverter. telemetry.Store.GridInverter reads the inverter of a driver whose telemetry is live, a fault included, for the grid state only. /api/status shows grid_state with its start and the reports it rests on, and the control journal keeps a site:grid span, an outage as a warning. Nothing acts on it yet; the off-grid behaviour and the push notifications, paired with the app, follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. |
frahlg
added a commit
that referenced
this pull request
Nov 29, 2026
…e-drivers#285) (#2138) Moves the pin to srcfl/device-drivers eeee2c48. Of the bundled drivers only foxess_h3_smart changes: 0.11.0 reports grid_state on its inverter stream from Status 3 bit 0 (39066), which #2132 reads into the site's grid state. konja-261-svk 0.5.0 does the same but is not bundled. Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Step 6 of the off-grid work in #2125. It reads
grid_statefrom the drivers in srcfl/device-drivers#285. Based onmaster: it touches none of the planner stack.Changeset:
minor, for the owner to approve.What it does
telemetry.InverterReading.GridStatereadsgrid_statefrom the inverter stream. Only"on_grid"and"off_grid"count; anything else is empty.gridstatefolds the fresh reports into the site's state on every control tick:LiveInverterhides a faulted device's reading.telemetry.Store.GridInverterreads the inverter of a driver whose telemetry is live, a fault included, and only for the grid state./api/statusshowsgrid_state:{state, since_ms, reports}.site:gridspan, with an outage as a warning so its span starts at once.lua.go's host API comment documents the field.Not in this PR
contract/push-catalogue.yamlmust be copied byte for byte to ftw-webapp and ftw-app in paired PRs.grid_state, so a site staysunknown.Evidence
go/internal/gridstate/gridstate_test.go:go/internal/api/api_grid_state_test.go: the journal'ssite:gridverdict is unknown at info and off grid at warning; a nil tracker is unknown.go test ./internal/gridstate/ ./internal/telemetry/ ./internal/api/passes, and./cmd/ftw/passes withumask 022.🤖 Generated with Claude Code