# Reading the N100's metered plug from DooPlex — 2026-10-13 Two readers for the Tuya Wi-Fi plug that powers the N100 (`demo-felhom`): tinytuya on the LAN, and Home Assistant installed from the Felhom catalog on demo-hp's guest 9201. Tool: `scripts/bench/plugmeter.py` (`scripts/bench/README.md`). No key, device id or token is in this folder; they live only in DooPlex `~/.config/felhom-bench/` (700/600). ## Setup facts - tinytuya **1.20.0** in `~/.venvs/plugmeter` (user venv; no sudo, no system package, no service). - Wizard: region `eu`, run in `~/.config/felhom-bench/` with its output sent to a 600 file. It found **1 device**, „Smart Wi-Fi Power Meter Socket", category `cz`. - `tinytuya scan`: LAN `192.168.0.115`, **protocol 3.4**. No fixed router address yet. - Home Assistant: deployed through the dashboard endpoint (`POST /api/stacks/home-assistant/deploy`, `{"DOMAIN":"enkisfelhom.hu","SUBDOMAIN":"ha"}`) at 14:33:34Z → **202**, container healthy at 14:35:46Z (image pull included). Before the first setup the public address answered **401** (the setup gate closed, as designed). The operator passed the gate with the dashboard sign-in, made the owner, added the Tuya integration by QR, and made a non-admin, local-access-only user `felhom-bench` with a long-lived token. ## Data points (read from the device, checked against Home Assistant's Tuya reading) | DP | code | unit | scale | CSV column | |---|---|---|---|---| | 19 | `cur_power` | W | ×10 | `watts` | | 18 | `cur_current` | mA | ×1 | `milliamps` | | 20 | `cur_voltage` | V | ×10 | `volts` | | 17 | `add_ele` | kWh | ×1000 | `kwh_total` — energy since the plug last reported to the cloud, NOT lifetime | Check: at 14:44–14:45Z tinytuya read 6.6–7.0 W, 59–60 mA, 229.9 V; Home Assistant (Tuya cloud — the same source the Smart Life app shows) read „7 W, 0.06 A, 230 V" on the operator's screen and 6.6 W through the API. Match within 0.5 W. Home Assistant's entities: `sensor.smart_wi_fi_power_meter_socket_{power,current,voltage,total_energy}`. A refresh is required: plain `status()` repeated one cached reading (3 identical rows at 2 s); `updatedps([18,19,20])` then `status()` gives a new value each time — the plug's previous measurement, so a row lags about one interval. ## Side by side — 10 minutes, N100 at rest, `--interval 2` (14:45:17–14:55:17Z) | | rows | mean W | median W | spread (sd) | min–max W | read gap median / max | gaps > 3 s | failed reads | |---|---|---|---|---|---|---|---|---| | tuya (LAN) | 215 | 8.36 | 7.20 | 2.67 | 6.1–19.1 | 2.0 s / 8.0 s | 56 | 0 | | ha (cloud) | 301 | 8.40 | 7.20 | 2.74 | 6.1–19.1 | 2.0 s / 2.1 s | 0 | 0 | `side-by-side-tuya.csv`, `side-by-side-ha.csv`. The two agree almost exactly — **but not independently**: **Control (`ha-alone-3min.csv`, 14:55:44–14:58:44Z):** with the tuya reader stopped, Home Assistant's power value **did not change once in 3 minutes** (6.5 W throughout). When the tuya reader ran again for 20 s, Home Assistant moved to the last value it pushed (7.9 W) and stayed there. So the plug reports to the cloud only when asked; Home Assistant's 2-second freshness in the side-by-side was the tuya reader's doing. Earlier, at 14:44:48Z, Home Assistant still showed 18.7 W from 14:44:21Z while the plug read 6.7 W. **Recommendation: `--source tuya` for every measurement; `--source ha` as the backup and for history.** Each tuya gap > 3 s is a slow read (up to 8 s), not a lost one. ## Home Assistant from our catalog — product notes - Install, gate and first setup worked with no defect found. Deploy-to-healthy ~2 min 12 s. - A non-admin Home Assistant user **can still switch the plug** (`switch.smart_wi_fi_power_meter_socket_socket_1` is visible to it). Home Assistant has no read-only role. So the `felhom-bench` token can power off the N100; plugmeter only reads states. Home Assistant's design, not ours — no register row. - A household reading a Tuya meter plug only through Home Assistant's cloud integration gets a value that can sit still for minutes. Tuya's behaviour, not ours — no register row. - The `felhom-bench` user is local-access-only, so the public (Cloudflare) path is refused for it; plugmeter connects to the guest's LAN address `192.168.0.155` and checks the certificate by name. ## Teardown Machine: nothing provisioned on the N100. Host: none. Guest 9201: **Home Assistant stays installed on purpose** (the plug's second reader, `operations/nodes.md`). Hub: nothing. DooPlex: the user venv and `~/.config/felhom-bench/` stay.