Repository navigation
feat(homelink): show remote energy overview - #664
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 902291a80f
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| if siteMeterDriver == "" { | ||
| response.GridAvailable = true | ||
| } else if health := tel.DriverHealth(siteMeterDriver); health != nil && health.IsOnline() { |
There was a problem hiding this comment.
Use meter-usable health for the overview grid
When the configured site-meter driver is a hybrid inverter that has flagged DeviceFault but is still emitting meter telemetry, IsOnline() is false, so the Home Link overview reports the grid/load as unavailable even though the local status path deliberately treats non-offline site-meter telemetry as usable. This makes homes with a faulted battery/PV on the meter driver lose the whole remote overview; use a meter-specific stale/offline check here instead of the actuator IsOnline() predicate.
Useful? React with 👍 / 👎.
| totals, err := st.DailyEnergy(midnight.UnixMilli(), now.UnixMilli()) | ||
| if err != nil { | ||
| return homelink.OverviewReadResponse{}, err | ||
| } |
There was a problem hiding this comment.
Keep live overview when daily totals fail
If DailyEnergy returns an error (for example SQLite busy/closed during maintenance), this discards the live telemetry snapshot that was already assembled and consumes the one-use Home Link read grant, so the user sees a failed/denied overview rather than current grid/PV/load data. Since today's totals are optional (energy_today is omitted when unavailable), return the live response and omit/log the totals on this error instead of failing the whole overview.
Useful? React with 👍 / 👎.
* ci: stop new direct reads of cached telemetry outside the telemetry package A reading stays in telemetry.Store after its driver goes stale, offline or faulted. Every direct reader of RawW, SmoothedW, ReadingsByType or ReadingsByDriver must check driver health itself, and review caught the missing check in #36, #85, #310, #647, #664 and #740. The check counts those reads per file outside go/internal/telemetry and fails when a pull request adds one. Existing reads (147 today) may only go down. The error names the health-gated accessors to use instead. On the merged commits of #36, #85, #310 and #647 it fails. * ci: count telemetry reads across platforms and validate exceptions Signed-off-by: Fredrik Ahlgren <[email protected]> --------- Signed-off-by: Fredrik Ahlgren <[email protected]>
Summary
Checks