Skip to content

fix(control): ignore offline battery and PV watts when computing site load #1133

Closed

Description

@frahlg

siteLoadW mixes live meter watts with last-known battery and PV watts from drivers that are no longer online. That can skip protective PV export curtailment.

Found while reviewing dispatch safety on master 6eadec3f.

What happens

// go/internal/control/dispatch.go
for _, r := range store.ReadingsByType(telemetry.DerBattery) {
    batW += r.SmoothedW
}
for _, r := range store.ReadingsByType(telemetry.DerPV) {
    pvW += r.SmoothedW
}
load := gridW - batW - pvW - store.SumOnlineEVW() - store.SumOnlineV2XW()

EV and V2X already skip offline drivers (SumOnline*; telemetry_test.go exists because last-known EV W leaked into load math). Battery and PV do not.

protectiveCurtailLimitW then compares online PV generation to this mixed load. A dead inverter still showing cached −4 kW PV (the Ferroamp cache incident documented in go/internal/telemetry/store.go) inflates household load and can skip export protection. The opposite error: a dead battery stuck at +5 kW charge understates load.

This path is for DC-link / protective PV curtail, not the main battery PI. The comment on siteLoadW says a missing meter degrades to "don't engage". Offline PV does the reverse: it can make protection look unnecessary.

What a fix needs

  • Sum only online, non-stale battery and PV readings, matching EV/V2X.
  • Test: last-known −4 kW PV, driver watchdog-offline, live meter export — protection must not use the corpse reading (mirror TestSumOnlineEVWSkipsOfflineDrivers).
  • Same for an offline battery stuck at a large charge or discharge.

Open PR overlap: #1129 does not touch dispatch.go.

Activity

  1. added
    bug
    on Sep 8, 2026
  2. frahlg commented on Sep 8, 2026

    @frahlg
    MemberAuthor

    HA publishState (go/internal/ha/bridge.go) also sums ReadingsByType with no IsOnline() check. Support-report load math filters; HA does not. After the watchdog drops a driver, automations still see the last grid/PV/battery watts. Availability is process LWT, not meter freshness.

    Keep this issue for dispatch siteLoadW. HA is another consumer of the same last-known rows.

  3. added a commit that references this issue on Sep 8, 2026
    9e38fad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions