Repository navigation
feat(zap): opt-out PV aggregation via disable_pv config flag - #187
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
disable_pv: trueunder the driver'sconfig:block. Skips/api/devicesPV-inverter enumeration and Phase 3 aggregation; P1 meter polling is untouched.zap.luadriver, bound viadata-checkbox-pathso the generic settings saver round-trips it as a boolean.Why
Sites running two Sourceful Zaps — one with inverters, one as a spare P1 gateway on a different circuit — had both drivers walk
/api/devicesand 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
config.disable_pv: trueunder that driver, no changes to the primary Zap's config block.Zap: PV aggregation disabled via configat init andZap: PV inverters ignored (disable_pv=true)after discovery; nopvemissions appear in telemetry for that driver.🤖 Generated with Claude Code