Skip to content

feat(zap): opt-out PV aggregation via disable_pv config flag - #187

Merged
erikarenhill merged 3 commits into
masterfrom
feat/zap-disable-pv
Apr 24, 2026
Merged

erikarenhill merged 3 commits into
masterfrom
feat/zap-disable-pv

Conversation

@erikarenhill

Copy link
Copy Markdown
Collaborator

Summary

  • Lets a secondary Sourceful Zap act as a P1-only meter by setting disable_pv: true under the driver's config: block. Skips /api/devices PV-inverter enumeration and Phase 3 aggregation; P1 meter polling is untouched.
  • Settings → Devices shows a "Disable PV readings" checkbox on any zap.lua driver, bound via data-checkbox-path so the generic settings saver round-trips it as a boolean.
  • No impact on single-gateway deployments (flag defaults false). Primary Zap keeps owning PV aggregation as before.

Why

Sites running two Sourceful Zaps — one with inverters, one as a spare P1 gateway on a different circuit — had both drivers walk /api/devices and sum every inverter they saw, double-counting generation in site PV. Decided against forking the driver file; a config flag keeps a single driver, with opt-in semantics.

Test plan

  • Add a second Zap driver in Settings → Devices, tick "Disable PV readings", Save.
  • Verify the config.yaml round-trip: config.disable_pv: true under that driver, no changes to the primary Zap's config block.
  • Confirm logs: secondary driver prints Zap: PV aggregation disabled via config at init and Zap: PV inverters ignored (disable_pv=true) after discovery; no pv emissions appear in telemetry for that driver.
  • Site PV reading matches the primary Zap alone (not doubled).

🤖 Generated with Claude Code

erikarenhill and others added 3 commits April 23, 2026 19:41
Sites that run two Sourceful Zap gateways — one with inverters attached
and one used purely as a P1 meter — double-counted PV because both
drivers walked /api/devices and summed every inverter they saw. Adding
a boolean `disable_pv` to the driver's config map lets the secondary
Zap skip PV discovery and emit only the site meter, without forking
the driver file.

Settings → Devices surfaces the flag as a checkbox on any driver whose
Lua file is zap.lua, so operators can toggle it without hand-editing
YAML. Bound via data-checkbox-path so the generic settings saver picks
up the boolean.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ities

Replace the zap.lua filename regex with a catalog lookup: the checkbox
is rendered hidden on every HTTP driver, then `after` reveals it only
for drivers whose catalog entry declares both `meter` and `pv`. Any
new driver that emits both will pick up the toggle automatically
without a UI change.

Matches the existing site-meter post-render pattern — hide via DOM
edit instead of blocking render on the async catalog fetch.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
erikarenhill added a commit that referenced this pull request Apr 24, 2026
Picks up #187 on this branch so the EV work in flight can test
against a dual-Zap deployment without waiting on the other PR
to merge. Zap driver reads config.disable_pv; devices UI reveals
a "Disable PV readings" checkbox on any driver whose catalog
advertises both meter and pv, using the existing post-fetch DOM
pass so the catalog race doesn't hide it on first paint.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@erikarenhill
erikarenhill merged commit e265837 into master Apr 24, 2026
1 check passed
@frahlg
frahlg deleted the feat/zap-disable-pv branch August 7, 2026 08:17
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