From 3ec652c32d10ec2d006fe0d859c12db365fe29c5 Mon Sep 17 00:00:00 2001 From: Fredrik Ahlgren Date: Thu, 1 Oct 2026 11:29:28 +0200 Subject: [PATCH] fix(web): save unchecked Zap reads as false 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 Signed-off-by: Fredrik Ahlgren --- .changeset/zap-save-read-pv-off.md | 5 +++++ web/settings/tabs/devices.js | 10 +++++++++- web/setup-connection.test.mjs | 27 +++++++++++++++++++++++++-- web/setup.js | 14 +++++++++++++- web/setup.test.mjs | 6 ++++++ 5 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 .changeset/zap-save-read-pv-off.md diff --git a/.changeset/zap-save-read-pv-off.md b/.changeset/zap-save-read-pv-off.md new file mode 100644 index 000000000..11ad1df16 --- /dev/null +++ b/.changeset/zap-save-read-pv-off.md @@ -0,0 +1,5 @@ +--- +"ftw": patch +--- + +Save Zap PV and battery reads as off when the boxes are unchecked. Before, setup and Settings left `read_pv` out, so Core waited for PV readings the Zap never sends. Open Settings → Devices and save once to fix a Zap added before this release. diff --git a/web/settings/tabs/devices.js b/web/settings/tabs/devices.js index fdd5a97be..d08ca6ba8 100644 --- a/web/settings/tabs/devices.js +++ b/web/settings/tabs/devices.js @@ -1206,6 +1206,14 @@ ''; } if (isLocalHTTP) { + var isZap = (d.lua || '').indexOf('zap.lua') >= 0; + if (isZap) { + // Zap reads PV and battery only on opt-in. An unchecked box must + // save false: Core treats a missing read_pv as PV that may report. + d.config = d.config || {}; + if (d.config.read_pv == null) d.config.read_pv = false; + if (d.config.read_battery == null) d.config.read_battery = false; + } var lcfg = d.config || {}; // NIBE-style local-API drivers (catalog apicreds + a connection port) // also need a username + an optional self-signed cert pin; plain @@ -1219,7 +1227,7 @@ html += '
HTTP' + '' + '' + - ((d.lua || '').indexOf('zap.lua') >= 0 + (isZap ? '

This driver is the P1/HAN site meter by default. Prefer a native driver for inverters and batteries. Turn on a read below only when Zap is the only reader — a SolarEdge whose Modbus is closed, or an inverter on RS-485 that Zap already owns. Zap never writes.

' + '