feat(zap): opt-in read of PV and battery from Zap - #974
Conversation
Keep Zap as the P1/HAN meter by default. Settings → Devices can turn on read-only PV or battery ingest when Zap is the only reader. The driver never writes. Bundled pin moves to srcfl/device-drivers@60021a0 (srcfl/device-drivers#100). Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e7ac82aaa
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| '<label class="drv-read-pv" style="margin-top:8px;display:flex;align-items:center;gap:6px;font-weight:normal">' + | ||
| '<input type="checkbox" data-checkbox-path="drivers.' + idx + '.config.read_pv"' + | ||
| (lcfg.read_pv ? ' checked' : '') + '>' + | ||
| 'Read PV from devices on this Zap ' + | ||
| help('Pull generation from inverters Zap already talks to. Leave this off when a native inverter driver owns PV, so Combined does not count the same array twice.') + | ||
| '</label>' + | ||
| '<label class="drv-read-battery" style="margin-top:8px;display:flex;align-items:center;gap:6px;font-weight:normal">' + | ||
| '<input type="checkbox" data-checkbox-path="drivers.' + idx + '.config.read_battery"' + |
There was a problem hiding this comment.
Gate ingest switches on the active Zap capability
When an existing site still resolves drivers/zap.lua to a managed or local pre-3.1 driver, these filename-only controls remain visible even though that driver does not implement read_pv or read_battery. Saving either switch therefore succeeds but produces no telemetry, misleading the operator into believing ingest is enabled. The repository deliberately gives managed/local drivers precedence over the newly pinned bundled copy, so render these controls only when the active catalog entry/version declares the corresponding capability.
Useful? React with 👍 / 👎.


Summary
Zap is still the P1/HAN site meter by default. Sites that cannot talk to the inverter from FTW — closed SolarEdge Modbus, no SetApp, or Zap already owning the RS-485 bus — can turn on a read-only ingest of PV and/or battery under Settings → Devices.
That is the Discord case: Zap already had the PV reading, native Modbus did not. Dual-Modbus sites keep the 3.0 path because both flags default off.
The driver never writes. Chargers stay out.
Depends on srcfl/device-drivers#100 (
zap3.1.0). Bundled pin moves to60021a0. That pin is currentdevice-driversmain plus the Zap change, so the recovery snapshot also picks upnibe_local1.1.3,foxess_h3_smart0.9.5 and a smallmyuplinkfix already on main. After #100 merges, move the pin to the merge commit if GitHub squashes.Operator path
Settings → Devices → Zap:
YAML equivalent:
config.read_pv: true/config.read_battery: true.Test plan
go test ./internal/drivers -run 'Zap|zap|CatalogSourceful'go test ./internal/drivers ./cmd/ftwnode --test web/setup.test.mjsmake verify(pre-commit)Note
Medium Risk
Touches site telemetry aggregation (double-counting if both Zap and a native driver are enabled) but remains read-only with flags off by default. Bundled driver pin also advances other recovery snapshots.
Overview
Zap stays the P1/HAN site meter by default, but operators can now opt in to read-only PV and/or battery telemetry from devices Zap already talks to (
config.read_pv/config.read_battery, also under Settings → Devices). Use this when a native driver cannot reach the inverter (closed Modbus, Zap-owned RS-485). Chargers are still never ingested, and the driver still never writes.Catalog capabilities now include
meter,pv, andbatteryso Combined can see those DERs; generic disable-PV/battery checkboxes are hidden for Zap so they do not fight the new opt-ins. Tests cover independent PV vs battery ingest, aggregation across inverters, and no synthetic meter on inverter-only sites. Bundled drivers pin moves to pick up Zap 3.1.0.Reviewed by Cursor Bugbot for commit 5e7ac82. Bugbot is set up for automated code reviews on this repo. Configure here.