60ac42e711
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)
159 lines
3.6 KiB
YAML
159 lines
3.6 KiB
YAML
version: 1
|
|
|
|
brokers:
|
|
mosquitto:
|
|
host: mosquitto
|
|
port: 1883
|
|
|
|
# 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:
|
|
- base: Dashboard
|
|
pages:
|
|
- page: Home
|
|
icon: home
|
|
path: /home
|
|
groups:
|
|
- name: Plugs
|
|
width: 6
|
|
|
|
flows:
|
|
- tab: Zigbee Monitor
|
|
description: Button dispatches single vs hold-release to different plug sets
|
|
nodes:
|
|
- id: zigbee-state-squiggle
|
|
type: mqtt in
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/Squiggle
|
|
qos: 0
|
|
|
|
- id: zigbee-state-sideboard
|
|
type: mqtt in
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/Sideboard Lamp
|
|
qos: 0
|
|
|
|
- id: zigbee-state-bamboo
|
|
type: mqtt in
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/Bamboo Lights
|
|
qos: 0
|
|
|
|
- id: zigbee-state-djbooth
|
|
type: mqtt in
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/DJ Booth
|
|
qos: 0
|
|
|
|
- id: button-in
|
|
type: mqtt in
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/Door Button
|
|
qos: 0
|
|
|
|
- id: single-filter
|
|
type: function
|
|
name: Single click
|
|
code: |
|
|
try {
|
|
const p = JSON.parse(msg.payload);
|
|
if (p.action === 'single') {
|
|
msg.payload = { state: 'TOGGLE' };
|
|
return msg;
|
|
}
|
|
} 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
|
|
topic: zigbee2mqtt/Squiggle/set
|
|
|
|
- id: plug-out-sideboard
|
|
type: mqtt out
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/Sideboard Lamp/set
|
|
|
|
- id: plug-out-bamboo
|
|
type: mqtt out
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/Bamboo Lights/set
|
|
|
|
- id: plug-out-djbooth
|
|
type: mqtt out
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/DJ Booth/set
|
|
|
|
- id: text-squiggle
|
|
type: ui-text
|
|
group: Plugs
|
|
label: Squiggle
|
|
format: "{{msg.payload.state}}"
|
|
order: 1
|
|
|
|
- id: text-sideboard
|
|
type: ui-text
|
|
group: Plugs
|
|
label: Sideboard Lamp
|
|
format: "{{msg.payload.state}}"
|
|
order: 2
|
|
|
|
- id: text-bamboo
|
|
type: ui-text
|
|
group: Plugs
|
|
label: Bamboo Lights
|
|
format: "{{msg.payload.state}}"
|
|
order: 3
|
|
|
|
- id: text-djbooth
|
|
type: ui-text
|
|
group: Plugs
|
|
label: DJ Booth
|
|
format: "{{msg.payload.state}}"
|
|
order: 4
|
|
|
|
- id: permit-btn
|
|
type: ui-button
|
|
group: Plugs
|
|
label: Permit Join (60s)
|
|
topic: zigbee2mqtt/bridge/request/permit_join
|
|
payload:
|
|
value: true
|
|
time: 60
|
|
order: 5
|
|
|
|
- id: mqtt-out
|
|
type: mqtt out
|
|
broker: mosquitto
|
|
|
|
wires:
|
|
zigbee-state-squiggle: [text-squiggle]
|
|
zigbee-state-sideboard: [text-sideboard]
|
|
zigbee-state-bamboo: [text-bamboo]
|
|
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]
|