Skip to content

fix(history): keep P1 household and PV energy observations - #1730

Merged
frahlg merged 2 commits into
masterfrom
codex/history-zap-pv-20261018
Oct 18, 2026
Merged

frahlg merged 2 commits into
masterfrom
codex/history-zap-pv-20261018

Conversation

@frahlg

@frahlg frahlg commented Oct 18, 2026

Copy link
Copy Markdown
Member

A P1/HAN-only meter with read_battery: false could still require battery power when stored capacity or telemetry-only settings remained. That made household history incomplete even while grid and PV reports continued. Honor the explicit reading setting, while still rejecting a battery flow that has actually reported and then gone stale.

A PV meter reporting generation together with a zero cumulative register also wrote zero energy. Use bounded power integration in that case, labelled power_telemetry / integrated. Keep valid positive counters authoritative. When a usable counter first arrives, close only the final observed power interval and use the counter as a new baseline, avoiding both a lost interval and double counting.

Validation:

  • New regressions fail on exact published v0.151.0-beta.1 (19a36f11) and on the local combined candidate before the fix.
  • SQLite persistence and native appHistory.Window now retain household data; two minutes at 3 kW produce 100 Wh instead of zero.
  • Cover catalog unavailability, stale observed battery, counter return/reset, zero generation, coarse positive counters and gaps over two minutes.
  • Full make verify and targeted race checks pass. Counter cursors also survive closing and reopening SQLite, including a zero cursor left by the previous Core.

This does not rewrite old history, change the driver pin, alter SQLite budgets or change an app view. Customer hardware and any historical recovery still need their own evidence.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T15:22:38.921657Z 9a396c4 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@frahlg
frahlg merged commit 4b263f7 into master Oct 18, 2026
23 checks passed
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.

1 participant