flow: add Dual Outlet - Couch to single-press button automation
Dual plug only responds to per-channel state_1/state_2 commands, not the
shared {state:TOGGLE} payload. Route single-filter through a couch-mapper
that emits {"state_1":"TOGGLE","state_2":"TOGGLE"} so both outlets flip.
Also adds state-in node, /set out node, and dashboard widget showing
state_1/state_2. Verified E2E + 567 Rego checks pass.
Refs: david/nr-flow-validator#2
This commit is contained in:
@@ -10,6 +10,7 @@ single_plugs:
|
|||||||
- Squiggle
|
- Squiggle
|
||||||
- Sideboard Lamp
|
- Sideboard Lamp
|
||||||
- Bamboo Lights
|
- Bamboo Lights
|
||||||
|
- Dual Outlet - Couch
|
||||||
|
|
||||||
# Plugs toggled on press-hold-release (action: "release" after a "hold")
|
# Plugs toggled on press-hold-release (action: "release" after a "hold")
|
||||||
hold_plugs:
|
hold_plugs:
|
||||||
@@ -53,6 +54,12 @@ flows:
|
|||||||
topic: zigbee2mqtt/DJ Booth
|
topic: zigbee2mqtt/DJ Booth
|
||||||
qos: 0
|
qos: 0
|
||||||
|
|
||||||
|
- id: zigbee-state-couch
|
||||||
|
type: mqtt in
|
||||||
|
broker: mosquitto
|
||||||
|
topic: zigbee2mqtt/Dual Outlet - Couch
|
||||||
|
qos: 0
|
||||||
|
|
||||||
- id: button-in
|
- id: button-in
|
||||||
type: mqtt in
|
type: mqtt in
|
||||||
broker: mosquitto
|
broker: mosquitto
|
||||||
@@ -113,6 +120,18 @@ flows:
|
|||||||
broker: mosquitto
|
broker: mosquitto
|
||||||
topic: zigbee2mqtt/DJ Booth/set
|
topic: zigbee2mqtt/DJ Booth/set
|
||||||
|
|
||||||
|
- id: couch-mapper
|
||||||
|
type: function
|
||||||
|
name: Toggle both outlets
|
||||||
|
code: |
|
||||||
|
msg.payload = { state_1: 'TOGGLE', state_2: 'TOGGLE' };
|
||||||
|
return msg;
|
||||||
|
|
||||||
|
- id: plug-out-couch
|
||||||
|
type: mqtt out
|
||||||
|
broker: mosquitto
|
||||||
|
topic: zigbee2mqtt/Dual Outlet - Couch/set
|
||||||
|
|
||||||
- id: text-squiggle
|
- id: text-squiggle
|
||||||
type: ui-text
|
type: ui-text
|
||||||
group: Plugs
|
group: Plugs
|
||||||
@@ -141,6 +160,13 @@ flows:
|
|||||||
format: "{{msg.payload.state}}"
|
format: "{{msg.payload.state}}"
|
||||||
order: 4
|
order: 4
|
||||||
|
|
||||||
|
- id: text-couch
|
||||||
|
type: ui-text
|
||||||
|
group: Plugs
|
||||||
|
label: Dual Outlet - Couch
|
||||||
|
format: "{{msg.payload.state_1}} / {{msg.payload.state_2}}"
|
||||||
|
order: 6
|
||||||
|
|
||||||
- id: permit-btn
|
- id: permit-btn
|
||||||
type: ui-button
|
type: ui-button
|
||||||
group: Plugs
|
group: Plugs
|
||||||
@@ -160,7 +186,9 @@ flows:
|
|||||||
zigbee-state-sideboard: [text-sideboard]
|
zigbee-state-sideboard: [text-sideboard]
|
||||||
zigbee-state-bamboo: [text-bamboo]
|
zigbee-state-bamboo: [text-bamboo]
|
||||||
zigbee-state-djbooth: [text-djbooth]
|
zigbee-state-djbooth: [text-djbooth]
|
||||||
|
zigbee-state-couch: [text-couch]
|
||||||
button-in: [single-filter, hold-filter]
|
button-in: [single-filter, hold-filter]
|
||||||
single-filter: [plug-out-squiggle, plug-out-sideboard, plug-out-bamboo]
|
single-filter: [plug-out-squiggle, plug-out-sideboard, plug-out-bamboo, couch-mapper]
|
||||||
|
couch-mapper: [plug-out-couch]
|
||||||
hold-filter: [plug-out-djbooth]
|
hold-filter: [plug-out-djbooth]
|
||||||
permit-btn: [mqtt-out]
|
permit-btn: [mqtt-out]
|
||||||
|
|||||||
Reference in New Issue
Block a user