Skip to content

Commit 2304152

Browse files
dcjclaude
andcommitted
examples: add utility-meter publisher
Reference implementation of an eBus utility-meter publisher (`energy.ebus.device.utility-meter`, per the Electrification Bus specification's `data-models/utility-meter.md`). Single-file script following the same `*Device` / `*DeviceAdapter` shape as `simple-device`: - `UtilityMeter` — pure-Python model holding values for the four standard capabilities (`info`, `meter`, `status`, `doe`). - `UtilityMeterAdapter` — translates the model to a Homie 5 device with capability-typed nodes and property datatype/unit hints. - DOE HTTP endpoint — `POST /doe/import-limit` accepting `{watts, source, validUntil}` to set the dynamic operating envelope at runtime. - Periodic `tick()` stub for synthetic measurement updates. Includes `utility-meter-cfg.example.json` with a generic nameplate and an example `meter` sample. Broker config is supplied separately in the same format as the other examples. Suitable for a Raspberry Pi or any Linux host as a stand-in utility meter on a test bench. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 527986e commit 2304152

3 files changed

Lines changed: 643 additions & 0 deletions

File tree

examples/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ Controller that auto-discovers Homie devices and monitors property changes.
2020
./simple-controller --config /path/to/broker-cfg.json
2121
```
2222

23+
### utility-meter
24+
25+
Publishes a single eBus utility-meter device (`energy.ebus.device.utility-meter`, per the Electrification Bus `data-models/utility-meter.md`) with the standard `info` / `meter` / `status` / `doe` capabilities. Includes a local HTTP endpoint for runtime DOE updates (`POST /doe/import-limit`).
26+
27+
```bash
28+
./utility-meter --config ./utility-meter-cfg.example.json --broker-config /path/to/broker-cfg.json
29+
```
30+
31+
Set DOE values at runtime:
32+
33+
```bash
34+
curl -X POST http://localhost:8765/doe/import-limit \
35+
-H 'Content-Type: application/json' \
36+
-d '{"watts": 12000, "source": "GRID", "validUntil": "2026-06-07T19:00:00Z"}'
37+
```
38+
2339
### simple-span-controller
2440

2541
SPAN Panel controller with mDNS discovery. Connects via MQTTS and monitors power flow properties.

0 commit comments

Comments
 (0)