Skip to content

fix(web): save unchecked Zap reads as false - #1484

Merged
frahlg merged 2 commits into
masterfrom
zap-save-read-pv
Oct 1, 2026
Merged

frahlg merged 2 commits into
masterfrom
zap-save-read-pv

Conversation

@frahlg

@frahlg frahlg commented Oct 1, 2026

Copy link
Copy Markdown
Member

Refs #1441. Pairs with #1480.

Problem

The Zap driver reads PV only when read_pv is true. Setup and Settings → Devices left read_pv and read_battery out of the saved config when the boxes stayed unchecked. Settings writes a checkbox only when the owner changes it.

forecastMeasurementTopology skips Zap PV only when read_pv is explicitly false. With the key missing, it expects sourceful-zap:pv, and the forecast learner waits for PV the Zap never sends. #1480 keeps history running; this change fixes the saved config.

Change

  • Setup writes read_pv: false and read_battery: false when it adds a Zap.
  • Settings → Devices fills a missing read_pv or read_battery with false when it shows a Zap. A new Zap from "Add new device" gets the same. A value already set, such as true or "true" in hand-edited YAML, stays as is.

No new settings. No Go change: #1480 has right of way on forecast_measurements.go.

Stored configs

A Zap saved before this change still has no read_pv. Opening Settings → Devices and pressing Save writes false. Until then the forecast learner behaves as before.

Core could treat a missing read_pv as false. It has no generic way to know which drivers expose the option, so that would need a Zap check by Lua path in Core. I left it out; say if you want it after #1480 lands.

Evidence

  • New wizard test runs the real setup.js, adds a Zap from a catalog entry and checks the posted config has read_pv: false and read_battery: false. It fails on master.
  • New source test pins the Settings fill. It fails on master.
  • npm test: 645 pass.
  • make verify passes.
  • Browser: ran Core locally with a Zap whose config had only host. Opened Settings → Devices, left both boxes unchecked, pressed Save. GET /api/config then returned read_pv: false, read_battery: false.

🤖 Generated with Claude Code

Setup and Settings left read_pv and read_battery out of a Zap config
when the boxes stayed unchecked. Core treats a missing read_pv as PV
that may report, so the forecast learner waited for PV the Zap never
sends (#1441).

Setup now writes both keys as false for a new Zap. Settings fills a
missing key with false when it shows a Zap, so the next save repairs
an older config. A value the owner set is left as is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 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-01T09:31:53.088264Z 3ec652c 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 63cf608 into master Oct 1, 2026
12 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