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
+72 -53
View File
@@ -1,6 +1,6 @@
[
{
"id": "braff51339",
"id": "brdf4ae094",
"type": "mqtt-broker",
"name": "mosquitto",
"broker": "mosquitto",
@@ -22,7 +22,7 @@
"willPayload": ""
},
{
"id": "uibab06e3f4",
"id": "uib11a5cfce",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
@@ -36,7 +36,7 @@
"titleBarStyle": "default"
},
{
"id": "uit4a70230a",
"id": "uit87ac5318",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
@@ -54,13 +54,13 @@
}
},
{
"id": "uip2851213f",
"id": "uip5130977b",
"type": "ui-page",
"name": "Home",
"ui": "uibab06e3f4",
"ui": "uib11a5cfce",
"icon": "home",
"path": "/home",
"theme": "uit4a70230a",
"theme": "uit87ac5318",
"layout": "flex",
"order": 0,
"className": "",
@@ -68,10 +68,10 @@
"disabled": false
},
{
"id": "uig93b85217",
"id": "uig5860869f",
"type": "ui-group",
"name": "Plugs",
"page": "uip2851213f",
"page": "uip5130977b",
"width": "6",
"height": "1",
"order": 1,
@@ -81,11 +81,11 @@
"disabled": false
},
{
"id": "fd235da06",
"id": "fbc766ae4",
"type": "tab",
"label": "Zigbee Monitor",
"disabled": false,
"info": "Single button toggles all plugs",
"info": "Button dispatches single vs hold-release to different plug sets",
"env": []
},
{
@@ -99,11 +99,11 @@
"name": "",
"x": 170,
"y": 80,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/Squiggle",
"qos": "0",
"datatype": "auto",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "zigbee-state-sideboard",
@@ -116,11 +116,11 @@
"name": "",
"x": 170,
"y": 80,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/Sideboard Lamp",
"qos": "0",
"datatype": "auto",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "zigbee-state-bamboo",
@@ -133,58 +133,58 @@
"name": "",
"x": 170,
"y": 80,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/Bamboo Lights",
"qos": "0",
"datatype": "auto",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "zigbee-state-laser",
"id": "zigbee-state-djbooth",
"type": "mqtt in",
"wires": [
[
"text-laser"
"text-djbooth"
]
],
"name": "",
"x": 170,
"y": 220,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/DJ Booth",
"qos": "0",
"datatype": "auto",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "button-in",
"type": "mqtt in",
"wires": [
[
"btn-filter"
"single-filter",
"hold-filter"
]
],
"name": "",
"x": 170,
"y": 220,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/Door Button",
"qos": "0",
"datatype": "auto",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "btn-filter",
"id": "single-filter",
"type": "function",
"wires": [
[
"plug-out-squiggle",
"plug-out-sideboard",
"plug-out-bamboo",
"plug-out-laser"
"plug-out-bamboo"
]
],
"name": "Single press",
"name": "Single click",
"x": 450,
"y": 220,
"func": "try {\n const p = JSON.parse(msg.payload);\n if (p.action === 'single') {\n msg.payload = { state: 'TOGGLE' };\n return msg;\n }\n} catch (e) {}\nreturn null;\n",
@@ -193,7 +193,26 @@
"initialize": "",
"finalize": "",
"libs": [],
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "hold-filter",
"type": "function",
"wires": [
[
"plug-out-djbooth"
]
],
"name": "Hold release",
"x": 450,
"y": 360,
"func": "try {\n const p = JSON.parse(msg.payload);\n if (p.action === 'release') {\n msg.payload = { state: 'TOGGLE' };\n return msg;\n }\n} catch (e) {}\nreturn null;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"z": "fbc766ae4"
},
{
"id": "plug-out-squiggle",
@@ -202,11 +221,11 @@
"name": "",
"x": 770,
"y": 360,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/Squiggle/set",
"qos": "2",
"retain": false,
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "plug-out-sideboard",
@@ -215,11 +234,11 @@
"name": "",
"x": 770,
"y": 360,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/Sideboard Lamp/set",
"qos": "2",
"retain": false,
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "plug-out-bamboo",
@@ -227,25 +246,25 @@
"wires": [],
"name": "",
"x": 770,
"y": 360,
"broker": "braff51339",
"y": 500,
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/Bamboo Lights/set",
"qos": "2",
"retain": false,
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "plug-out-laser",
"id": "plug-out-djbooth",
"type": "mqtt out",
"wires": [],
"name": "",
"x": 770,
"y": 500,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "zigbee2mqtt/DJ Booth/set",
"qos": "2",
"retain": false,
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "text-squiggle",
@@ -254,7 +273,7 @@
"name": "Squiggle",
"x": 770,
"y": 500,
"group": "uig93b85217",
"group": "uig5860869f",
"width": "6",
"height": "2",
"order": 1,
@@ -262,7 +281,7 @@
"format": "{{msg.payload.state}}",
"layout": "row-spread",
"className": "",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "text-sideboard",
@@ -270,8 +289,8 @@
"wires": [],
"name": "Sideboard Lamp",
"x": 770,
"y": 500,
"group": "uig93b85217",
"y": 640,
"group": "uig5860869f",
"width": "6",
"height": "2",
"order": 2,
@@ -279,7 +298,7 @@
"format": "{{msg.payload.state}}",
"layout": "row-spread",
"className": "",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "text-bamboo",
@@ -288,7 +307,7 @@
"name": "Bamboo Lights",
"x": 770,
"y": 640,
"group": "uig93b85217",
"group": "uig5860869f",
"width": "6",
"height": "2",
"order": 3,
@@ -296,16 +315,16 @@
"format": "{{msg.payload.state}}",
"layout": "row-spread",
"className": "",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "text-laser",
"id": "text-djbooth",
"type": "ui-text",
"wires": [],
"name": "DJ Booth",
"x": 770,
"y": 640,
"group": "uig93b85217",
"group": "uig5860869f",
"width": "6",
"height": "2",
"order": 4,
@@ -313,7 +332,7 @@
"format": "{{msg.payload.state}}",
"layout": "row-spread",
"className": "",
"z": "fd235da06"
"z": "fbc766ae4"
},
{
"id": "permit-btn",
@@ -325,8 +344,8 @@
],
"name": "Permit Join (60s)",
"x": 170,
"y": 640,
"group": "uig93b85217",
"y": 780,
"group": "uig5860869f",
"payload": "{\"value\": true, \"time\": 60}",
"payloadType": "json",
"topic": "zigbee2mqtt/bridge/request/permit_join",
@@ -334,7 +353,7 @@
"height": "1",
"order": 5,
"className": "",
"z": "fd235da06",
"z": "fbc766ae4",
"icon": "",
"label": "Permit Join (60s)"
},
@@ -345,10 +364,10 @@
"name": "",
"x": 770,
"y": 780,
"broker": "braff51339",
"broker": "brdf4ae094",
"topic": "",
"qos": "2",
"retain": false,
"z": "fd235da06"
"z": "fbc766ae4"
}
]