feat(zap): treat Zap as the P1/HAN meter only - #81
Conversation
FTW must not ingest inverters, batteries or chargers through Zap. Those devices belong in FTW with their own drivers. If Zap lists any of them, the driver now says so and leaves them unread. BREAKING CHANGE: sites that used Zap as a proxy for PV, battery or V2X lose that telemetry until they add the native driver.
|
Replaced by a single Signed-off-by commit on zap/p1-han-meter-signed (DCO failed on the first two commits). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e96d0739ec
ℹ️ 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".
| if der.type == "meter" then | ||
| rec.meter = true | ||
| if not first_meter then first_meter = sn end | ||
| elseif der.type == "pv" and not disable_pv then | ||
| rec.pv = true | ||
| rec.pv_rated_w = number(der.rated_power) or number(der.installed_power) or rec.pv_rated_w | ||
| elseif der.type == "battery" and not disable_battery then | ||
| rec.battery = true | ||
| rec.battery_rated_w = number(der.rated_power) or rec.battery_rated_w | ||
| rec.battery_capacity_wh = number(der.capacity) or rec.battery_capacity_wh | ||
| elseif der.type == "v2x_charger" and not disable_v2x then | ||
| rec.v2x = true | ||
| rec.v2x_capacity_wh = number(der.capacity) or rec.v2x_capacity_wh | ||
| is_meter = true | ||
| if not first_meter then first_meter = tostring(dev.sn) end |
There was a problem hiding this comment.
Restrict fallback selection to a P1/HAN meter
When /api/devices contains a non-P1 attached energy meter but no type == "p1_uart" entry, discover_devices() assigns that device to first_meter, and the later selection fetches and emits it as the site meter. This retains the proxy behavior that version 3.0.0 claims to remove and can report the wrong site telemetry; restrict selection to known P1/HAN identifiers, including explicitly mapped legacy identifiers if needed, and treat other meters as external resources.
Useful? React with 👍 / 👎.
| notes: "Official Sourceful Zap local-API integration for meter, PV, battery and V2X telemetry; safe leased control is pending firmware support." | ||
| min_driver_version: "2.0.0" | ||
| notes: "P1/HAN site meter from a Sourceful Zap. Inverters, batteries and chargers found on Zap must be added in FTW with their own drivers." | ||
| min_driver_version: "3.0.0" |
There was a problem hiding this comment.
Record the Zap API in upstream_docs
The edited driver identifies the official Zap Local API as the contract it was decoded against, but the manifest still has no upstream_docs entry for that URL. Consequently, the repository's watcher cannot detect when this API reference changes or disappears; add it as an api_docs entry in the manifest.
AGENTS.md reference: AGENTS.md:L60-L66
Useful? React with 👍 / 👎.
Summary
other_resourcesso the operator adds those devices in FTW with their own drivers.disable_pv/disable_battery/disable_v2xare gone because those DERs are no longer read.People have been adding an inverter to Zap and then using the Zap integration in FTW as a proxy. That is unnecessary and not recommended.
Breaking
Sites that used Zap as the only path for an inverter, battery or charger lose that telemetry until they add the native FTW driver.
Test plan
make test-driver ID=zapscripts/sync-bundled-drivers.sh)