517f3dbdae
Button (Door Button) now toggles Squiggle, Sideboard Lamp, and Bamboo Lights
via three parallel mqtt-out publishes.
Key fix: avoid subscribing to a wildcard '#' topic alongside a specific topic
in the same Node-RED instance. The mqtt-broker re-adds its handler as an
EventEmitter listener on each subscribe call (file:
/usr/src/node-red/node_modules/@node-red/nodes/core/network/10-mqtt.js
_clientOn('message', subscription.handler) is unconditional), so after
each deploy/restart the same message arrives N times to internal listeners.
Each mqtt-in node now uses a unique topic (zigbee2mqtt/<device>).
Removed zigbee-in # wildcard and plug-state ui-text widgets (state now
displayed via per-plug ui-text widgets).
Added function node support to flow2json.py for msg filtering logic.
Added ui-text format/width/height defaults support.
Added dashboard 2.0 config node defaults matching reference flow:
ui-base, ui-theme, ui-page, ui-group with full property set.
117 lines
2.6 KiB
YAML
117 lines
2.6 KiB
YAML
version: 1
|
|
|
|
brokers:
|
|
mosquitto:
|
|
host: mosquitto
|
|
port: 1883
|
|
|
|
plugs:
|
|
- Squiggle
|
|
- Sideboard Lamp
|
|
- Bamboo Lights
|
|
|
|
dashboards:
|
|
- base: Dashboard
|
|
pages:
|
|
- page: Home
|
|
icon: home
|
|
path: /home
|
|
groups:
|
|
- name: Plugs
|
|
width: 6
|
|
|
|
flows:
|
|
- tab: Zigbee Monitor
|
|
description: Monitor and control zigbee2mqtt coordinator
|
|
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: button-in
|
|
type: mqtt in
|
|
broker: mosquitto
|
|
topic: zigbee2mqtt/Door Button
|
|
qos: 0
|
|
|
|
- id: btn-filter
|
|
type: function
|
|
name: Single press only
|
|
code: |
|
|
try {
|
|
const p = JSON.parse(msg.payload);
|
|
if (p.action === 'single') {
|
|
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: text-squiggle
|
|
type: ui-text
|
|
group: Plugs
|
|
label: Squiggle
|
|
format: "{{msg.payload.state}}"
|
|
|
|
- id: text-sideboard
|
|
type: ui-text
|
|
group: Plugs
|
|
label: Sideboard Lamp
|
|
format: "{{msg.payload.state}}"
|
|
|
|
- id: text-bamboo
|
|
type: ui-text
|
|
group: Plugs
|
|
label: Bamboo Lights
|
|
format: "{{msg.payload.state}}"
|
|
|
|
- id: permit-btn
|
|
type: ui-button
|
|
group: Plugs
|
|
label: Permit Join (60s)
|
|
topic: zigbee2mqtt/bridge/request/permit_join
|
|
payload:
|
|
value: true
|
|
time: 60
|
|
|
|
- id: mqtt-out
|
|
type: mqtt out
|
|
broker: mosquitto
|
|
|
|
wires:
|
|
zigbee-state-squiggle: [text-squiggle]
|
|
zigbee-state-sideboard: [text-sideboard]
|
|
zigbee-state-bamboo: [text-bamboo]
|
|
button-in: [btn-filter]
|
|
btn-filter: [plug-out-squiggle, plug-out-sideboard, plug-out-bamboo]
|
|
permit-btn: [mqtt-out]
|