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:
+28
-10
@@ -5,10 +5,14 @@ brokers:
|
||||
host: mosquitto
|
||||
port: 1883
|
||||
|
||||
plugs:
|
||||
# Plugs toggled on brief single press
|
||||
single_plugs:
|
||||
- Squiggle
|
||||
- Sideboard Lamp
|
||||
- Bamboo Lights
|
||||
|
||||
# Plugs toggled on press-hold-release (action: "release" after a "hold")
|
||||
hold_plugs:
|
||||
- DJ Booth
|
||||
|
||||
dashboards:
|
||||
@@ -23,7 +27,7 @@ dashboards:
|
||||
|
||||
flows:
|
||||
- tab: Zigbee Monitor
|
||||
description: Single button toggles all plugs
|
||||
description: Button dispatches single vs hold-release to different plug sets
|
||||
nodes:
|
||||
- id: zigbee-state-squiggle
|
||||
type: mqtt in
|
||||
@@ -43,7 +47,7 @@ flows:
|
||||
topic: zigbee2mqtt/Bamboo Lights
|
||||
qos: 0
|
||||
|
||||
- id: zigbee-state-laser
|
||||
- id: zigbee-state-djbooth
|
||||
type: mqtt in
|
||||
broker: mosquitto
|
||||
topic: zigbee2mqtt/DJ Booth
|
||||
@@ -55,9 +59,9 @@ flows:
|
||||
topic: zigbee2mqtt/Door Button
|
||||
qos: 0
|
||||
|
||||
- id: btn-filter
|
||||
- id: single-filter
|
||||
type: function
|
||||
name: Single press
|
||||
name: Single click
|
||||
code: |
|
||||
try {
|
||||
const p = JSON.parse(msg.payload);
|
||||
@@ -68,6 +72,19 @@ flows:
|
||||
} catch (e) {}
|
||||
return null;
|
||||
|
||||
- id: hold-filter
|
||||
type: function
|
||||
name: Hold release
|
||||
code: |
|
||||
try {
|
||||
const p = JSON.parse(msg.payload);
|
||||
if (p.action === 'release') {
|
||||
msg.payload = { state: 'TOGGLE' };
|
||||
return msg;
|
||||
}
|
||||
} catch (e) {}
|
||||
return null;
|
||||
|
||||
- id: plug-out-squiggle
|
||||
type: mqtt out
|
||||
broker: mosquitto
|
||||
@@ -83,7 +100,7 @@ flows:
|
||||
broker: mosquitto
|
||||
topic: zigbee2mqtt/Bamboo Lights/set
|
||||
|
||||
- id: plug-out-laser
|
||||
- id: plug-out-djbooth
|
||||
type: mqtt out
|
||||
broker: mosquitto
|
||||
topic: zigbee2mqtt/DJ Booth/set
|
||||
@@ -109,7 +126,7 @@ flows:
|
||||
format: "{{msg.payload.state}}"
|
||||
order: 3
|
||||
|
||||
- id: text-laser
|
||||
- id: text-djbooth
|
||||
type: ui-text
|
||||
group: Plugs
|
||||
label: DJ Booth
|
||||
@@ -134,7 +151,8 @@ flows:
|
||||
zigbee-state-squiggle: [text-squiggle]
|
||||
zigbee-state-sideboard: [text-sideboard]
|
||||
zigbee-state-bamboo: [text-bamboo]
|
||||
zigbee-state-laser: [text-laser]
|
||||
button-in: [btn-filter]
|
||||
btn-filter: [plug-out-squiggle, plug-out-sideboard, plug-out-bamboo, plug-out-laser]
|
||||
zigbee-state-djbooth: [text-djbooth]
|
||||
button-in: [single-filter, hold-filter]
|
||||
single-filter: [plug-out-squiggle, plug-out-sideboard, plug-out-bamboo]
|
||||
hold-filter: [plug-out-djbooth]
|
||||
permit-btn: [mqtt-out]
|
||||
|
||||
Reference in New Issue
Block a user