Repository navigation
feat(remne_p1ib): read-only site meter for the Remne P1IB bridge - #150
Conversation
Add a read-only meter driver for the Remne Technologies P1IB, a Wi-Fi P1/HAN reader common in Sweden. It reads the bridge's /meterData JSON rather than its MQTT output: P1IB publishes MQTT only when a value moves past its hysteresis, so a steady site would look stale to Core and stop dispatch. Freshness comes from the bridge's good-telegram counter, so the driver emits once per telegram and never re-emits the rolling window. connection_defaults declares an empty host so the setup wizard passes the entered IP as config.host; without the key a wizard-added driver never learns its address. Run in FTW v0.138.2-beta.1 against two P1IB units (rev F, fw 757b45d) on Landis+Gyr E360 meters, one as site meter. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Andy Lyeklint Hancock <[email protected]>
miravoss26
left a comment
There was a problem hiding this comment.
New read-only community driver remne_p1ib 0.1.0 (Remne P1IB bridge, HTTP /meterData polling instead of the bridge's own hysteresis-gated MQTT — the stated reason, avoiding false-stale site meters, is sound and matches how FTW treats a quiet site meter).
Correctness: read_only = true / control: false throughout, matches the driver's scope. Sign convention (w = (import - export) * 1000, site-positive) is consistent with the rest of the fleet. Freshness is driven off the bridge's info.okCnt telegram counter rather than value-change — correctly avoids re-emitting the rolling window as fresh, and correctly treats a lower counter (bridge reboot) as new data. Missing per-phase values are omitted rather than defaulted to 0, which matters here (a synthetic 0 A would disable the per-phase fuse guard per the driver's own comment) — good instinct. Exponential backoff on HTTP/JSON failures, capped at 60s. driver_cleanup resets all module state cleanly. Lua harness covers six real scenarios (first telegram + sign check, no-re-emit, stale-after-3-intervals warning, reboot-lower-counter, partial-phase-omission, empty-arrays-at-boot) and the PR body reports the full make check suite green plus real hardware validation against two live units.
Security: no secrets, no new external network destination — this talks to a bridge at a site-local, installer-entered IP (config.host), same shape as every other local HTTP driver here. No injection surface (base_url built from a validated non-empty string, JSON parsed through a pcall-wrapped decoder). No auth/control-path changes.
One thing worth a decision, not a blocker: the PR body flags that esphome_dsmr's connection_defaults has the same empty-host-block bug this driver had to work around (setup wizard fails with "config.host is required" unless the key is declared), and deliberately left it unfixed to keep this PR to one driver. Reasonable scoping call — might be worth a quick follow-up issue so it doesn't get lost, but not this PR's job to fix.
CI hasn't run yet (empty status-check list as of this review) — worth a second look once it reports. Safe to merge from my read once CI is green; device-drivers isn't on the auto-merge allowlist so this needs a human regardless.
Problem
The Remne Technologies P1IB is a common Wi-Fi P1/HAN reader in Sweden (sold by m.nu, among others). FTW has no driver for it. Its MQTT output is not usable as a site meter: the bridge publishes a value only when it moves past a per-sensor hysteresis ("reduced mode"), so a site whose load holds steady goes quiet for hours and Core marks the meter stale and stops dispatch.
Scope
One new read-only community driver,
remne_p1ib0.1.0, with its manifest, a behaviour test and a changelog entry. No change to any other driver or contract.GET /meterDataJSON: one request per poll.info.okCnt). The driver emits once per new telegram, never re-emits the rolling 10-value window, and logs once when no telegram has arrived for three telegram intervals (at least 30 s). A bridge reboot resets the counter and counts as new data.Remne Technologies, serialp1ib-<mac>, model from the meter string the bridge reports (e.g.LGF5E360).connection_defaultsdeclares an emptyhost, so the setup wizard passes the entered IP asconfig.host.The endpoint shape was read off live units. The firmware is closed; the paths match the strings in the published firmware image and the webservice mentioned in the vendor README, both listed in
upstream_docs.Test steps and results
make check: pass (4793 passed, 923 skipped).drivers/tests/test_remne_p1ib.pyruns a Lua harness over a synthetic/meterDatapayload: site sign convention per phase, no re-emit on an unchanged counter, one stale warning, bridge reboot, missing per-phase values omitted, empty arrays after boot. I checked that it fails when the counter check is removed and when the sign is flipped.Not tested: export (no solar at this site, so export has only been seen as 0), single-phase meters, and the P1IB Ethernet variant.
A related finding in
esphome_dsmrWhile adding the P1IB through the setup wizard, both drivers first failed at init with
config.host is required.web/setup.jsseedsconfig.hostonly when the catalog entry'sconnection_defaultshas ahostkey, and my first version had copiedesphome_dsmr's block, which contains only a comment.esphome_dsmr(1.0.6) has the same empty block and requiresconfig.host, so I expect it fails the same way when added through the wizard. I have not changed it here, to keep this PR to one driver. Declaringhost = ""there, as this driver now does, should be enough.🤖 Generated with Claude Code