Skip to content

feat(zap): opt-in read of PV and battery from Zap - #974

Merged
frahlg merged 2 commits into
masterfrom
zap-opt-in-read
Aug 24, 2026
Merged

feat(zap): opt-in read of PV and battery from Zap#974
frahlg merged 2 commits into
masterfrom
zap-opt-in-read

Conversation

@frahlg

@frahlg frahlg commented Aug 23, 2026

Copy link
Copy Markdown
Member

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 (zap 3.1.0). Bundled pin moves to 60021a0. That pin is current device-drivers main plus the Zap change, so the recovery snapshot also picks up nibe_local 1.1.3, foxess_h3_smart 0.9.5 and a small myuplink fix already on main. After #100 merges, move the pin to the merge commit if GitHub squashes.

Operator path

Settings → Devices → Zap:

  • Read PV from devices on this Zap
  • Read battery from devices on this Zap (telemetry only)

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/ftw
  • node --test web/setup.test.mjs
  • make verify (pre-commit)
  • Human look at Settings → Devices for a Zap entry (CODEOWNERS web rule)

Note

Medium Risk
Changes how site PV/battery telemetry can be sourced (double-count risk if opted in alongside a native driver). Reads stay opt-in and the driver remains write-inert.

Overview
Sourceful Zap stays the P1/HAN site meter by default, but operators can opt in to read-only PV and/or battery ingest from devices Zap already talks to (read_pv / read_battery in YAML, or Settings → Devices). Use this when FTW cannot talk to the inverter natively (closed Modbus, Zap owns RS-485). Chargers are still not ingested; the driver never writes.

Catalog capabilities now include pv and battery so the UI can offer those switches. Zap is excluded from the generic disable-PV/disable-battery overlap controls so Combined is not double-counted unless the operator turns a Zap read on.

Docs, example config, setup copy, and tests cover mixed sites, inverter-only Zap, and aggregation of multiple listed inverters. Bundled driver pin moves with the Zap 3.1.0 snapshot.

Reviewed by Cursor Bugbot for commit ce74bdf. Bugbot is set up for automated code reviews on this repo. Configure here.

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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1062 to +1069
'<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"' +

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

cursor[bot]
cursor Bot approved these changes Aug 23, 2026
srcfl/device-drivers#100 landed as 19dd64cc. Point the recovery snapshot
at that commit instead of the PR head.

Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@frahlg
frahlg merged commit 54f0163 into master Aug 24, 2026
17 checks passed
@frahlg
frahlg deleted the zap-opt-in-read branch August 24, 2026 08:54

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ce74bdf. Configure here.

],
"repository": "srcfl/device-drivers",
"commit": "042e0efe8827946de8178845746948f8555b3622",
"commit": "19dd64ccc563d4b1bd102793b066e3f75a83687d",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundled pin reverts intended commit

High Severity

The bundled pin moves from 60021a0 to 19dd64c, but this PR states the recovery snapshot should use 60021a0 — current device-drivers main plus the Zap 3.1.0 change (and the nibe_local / foxess_h3_smart / myuplink fixes already on main). Restoring the earlier pin can drop that Zap ingest support and those other driver fixes from the image that falls back to this snapshot.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ce74bdf. Configure here.

@cursor
cursor Bot requested review from Leitet and erikarenhill August 24, 2026 08:57
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