Split button: single→3 plugs, hold-release→DJ Booth only

zigbee-monitor.yaml:
- Single click (action=single) toggles Squiggle, Sideboard Lamp,
  Bamboo Lights
- Press-hold-release (action=release after hold) toggles DJ Booth
  only
- Two filter functions: "Single click" and "Hold release", button-in
  fan-out wires to both
- DJ Booth added to zigbee-state-in and ui-text widgets for visibility
- "plugs:" list replaced with "single_plugs:" and "hold_plugs:" for
  declarative clarity (generator doesn't use them, but documents intent)

infra/zigbee2mqtt/configuration.yaml:
- Removed DJ Booth from "all_plugs" group (now Squiggle, Sideboard
  Lamp, Bamboo Lights only)
- Pushed same change to live /root/zigbee2mqtt/configuration.yaml and
  restarted zigbee2mqtt container

Diagnostics in justfile + scripts/:

justfile:
- Constants: RPI_HOST, MQTT_HOST, MQTT_PORT, RPI_DIR, NR_PORT
- rpi, mqtt-pub, mqtt-sub, mqtt-watch, mqtt-button
- nr-show, nr-diff, nr-logs, nr-editor, nr-dashboard
- z2m-devices, z2m-logs, z2m-state
- mqtt-logs, restart, restart-all

scripts/mqtt.py:
- MQTT publish/subscribe/watch helpers using paho-mqtt v2.x
- Run via uv run --with paho-mqtt (no global install needed)

scripts/diag.py:
- nr-show: live flow summary with mqtt-out topic list
- nr-diff: structural diff deployed vs repo, normalizes random uuids
- z2m-devices: paired devices + group membership
- mqtt-button: publish action and watch /set topics (E2E test)

Verified end-to-end via `just mqtt-button`:
  single  → 3 messages on .../set (Squiggle, Sideboard Lamp, Bamboo Lights)
  release → 1 message on .../set (DJ Booth)
This commit is contained in:
2026-06-30 23:28:13 -07:00
parent de260eec62
commit 60ac42e711
8 changed files with 429 additions and 64 deletions
+15
View File
@@ -23,6 +23,21 @@ just deploy # push to Node-RED at 192.168.81.147:1880
See `infra/README.md` for the full Docker stack and rebuild procedure.
## Diagnostics
All diagnostic commands live in the justfile. Run `just --list` to see them.
- `just nr-show` — live flow summary (node count, functions, button wiring, mqtt-out topics)
- `just nr-diff` — diff deployed `/flows` against `output/<name>.json` (ignores random uuid ids)
- `just mqtt-button [action]` — E2E test: publish a button action and watch which `/set` topics fire
- `just z2m-devices` — paired zigbee devices + group membership
- `just mqtt-pub TOPIC PAYLOAD` / `just mqtt-sub TOPIC` / `just mqtt-watch` — raw MQTT
- `just nr-logs` / `just z2m-logs` / `just mqtt-logs` — container log tails
- `just restart SERVICE` / `just restart-all` — docker restart
- `just rpi CMD` — run any command on the RPi over SSH
`scripts/mqtt.py` and `scripts/diag.py` are the underlying helpers. Override the target host with `just RPI_HOST=user@host mqtt-button single`.
## Generation invariants
These are enforced by `policy/flow.rego` and burned in from real bugs found in deployment. The generator follows them by construction; the policy is the second line of defense.