Skip to content

fix(solar): suppress derived grid when meter inputs are missing - #136

Merged
gnacho merged 2 commits into
mainfrom
fix/135-grid-export-guard
Oct 3, 2026
Merged

gnacho merged 2 commits into
mainfrom
fix/135-grid-export-guard

Conversation

@gnacho

@gnacho gnacho commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Closes #135

Problem

With HAOS connected, unavailable consumption meters (Zigbee dropouts) collapse the derived consumption to 0. The bucket formula grid = consumption - production + batteryPower then fabricates impossible night exports (observed 26-Sep: -3.4 kW while the battery discharged ~3 kW and both consumption meters were down for ~10 min). The bogus buckets also inflated the day's grid-export KPIs.

Fix

  • buildDaySeries: if any formula input is missing in a bucket (any consumption meter, or the battery power sensor), grid is suppressed (null) instead of computed with zeros. The feat(day-series): fill consumption gap from previous-day pattern when all meters drop #125 previous-day pattern fill still recomputes grid from the estimated consumption and marks the day estimated.
  • computeLive: consumption meter down -> consumption null + warning alert; grid source entity down -> grid null (no night sign-flip or import fallback on fabricated zeros). Guards only apply while HA is connected.
  • Frontend: PowerPoint.grid and LivePower.grid/consumption are nullable; fmtKw renders an em dash for null; day-KPI integration skips null grid buckets; LivePowerStrip and EnergyFlowDiagram show no-data with neutral flows.

Tests

  • 4 new red-green tests reproducing the 26-Sep night scenario (full dropout, partial dropout, both live guards). Suite 115/115.
  • tsc --noEmit + vite build clean.
  • Deployed to the personal instance via the BYD overlay and validated.

gnacho added 2 commits October 3, 2026 10:27
With HAOS connected, unavailable consumption meters collapsed the derived
consumption to 0 and the bucket formula grid=consumption-production+battery
fabricated impossible night exports (real case 26-Sep: -3.4 kW while the
battery discharged and both meters were down).

- buildDaySeries: grid=null for buckets missing any consumption meter or
  the battery power sensor; the issue-125 pattern fill still recomputes
  grid from the estimated consumption and marks the day estimated
- computeLive: consumption=null + 'consumo' warning alert when any
  consumption meter is down; grid=null when the grid source entity is
  down (no sign-flip/import fallback on fabricated zeros)
- export buildDaySeries for tests; 4 new red-green tests (115/115)
…#135)

Follow-up to the server guard: PowerPoint.grid and LivePower.grid /
consumption are now nullable. fmtKw renders an em dash for null, the
day-KPI integration skips null grid buckets, LivePowerStrip and
EnergyFlowDiagram show '—' with neutral flows when a meter is down.
@gnacho
gnacho merged commit 3d0cf78 into main Oct 3, 2026
4 checks passed
@gnacho
gnacho deleted the fix/135-grid-export-guard branch October 3, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Impossible grid export shown at night when consumption meters drop

1 participant