Skip to content

Use one Core Load calculation for app, web and HA - #1733

Merged
frahlg merged 6 commits into
masterfrom
codex/core-live-load-20261018
Oct 18, 2026
Merged

frahlg merged 6 commits into
masterfrom
codex/core-live-load-20261018

Conversation

@frahlg

@frahlg frahlg commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

The phone could calculate house Load from smoothed readings while LAN used qualified source power. The native UI could then subtract EV draw again or turn missing Load into 0. HA and support reports also had their own live formulas.

Use one Core LiveMeasurementNow path and one source-options callback for LAN, phone sessions, Cloud, HA and live diagnostics. It uses measured site-side power, driver cadence and the existing balance checks. Remove the extra residuals, clamps and unused household filter.

Core sends a known 0 as 0. Invalid or missing Load becomes JSON null, an absent existing FID6, MQTT None, or unavailable text in the support report. The session's existing full-snapshot path clears a previously known value. The web view renders Core's Load without a second decision based on aggregate history quality. Historical energy intervals remain a separate quantity from current power.

Paired native client fix: srcfl/ftw-app#94. It preserves Core Load and its absence in iOS, Watch and the shared view model. Older app builds still need that client update. The continuous graph draft in app #93 is separate.

Validation:

  • Regressions fail before and pass after for app/LAN/Cloud agreement, raw versus smoothed power, site-side AC, real zero, stale/missing/skewed/negative inputs, idle/paused/faulted EV readings and live source-configuration changes.
  • Protocol tests cover known → absent → known zero and Cloud LiveView, including removal of an earlier value through a full snapshot.
  • MQTT tests inspect actual published payloads for loss, return and real zero; 10 targeted race runs pass. HA's numeric sensors use literal None for unknown: https://www.home-assistant.io/integrations/sensor.mqtt/#state_topic.
  • Support tests cover unavailable readings and prevent false model/slot findings against an invented zero. Targeted API, telemetry and command-package race tests pass.
  • The first full make verify stopped in the existing OCPP listener-start test (control_test.go:369). Its result is preserved; no deadline or assertion changed. The controlled make verify rerun, all web tests and uncached full Go race pass on exact head 4daab0799ead10d9abdbf4ab66bdbe7d476ca6bb. The race run completed 16:54:36 UTC with no failures or race warnings. Other local builds and cache cleanup stayed paused. The original startup-test cause remains unproven.

Fredrik asked for one calculation in Core and authorized this chat to publish the common beta and install it on his box. His earlier stable and migration holds remain separate from this beta review. No beta from this PR has been published or installed yet.

@frahlg
frahlg marked this pull request as ready for review October 18, 2026 16:56
@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-18T16:59:54.885843Z 4daab07 Draft marked ready
ℹ️ 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 d7f1d7b 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