Hello,
I’m new to NodeRed and I’m trying to port this simple yaml automation. The automation should toggle my office lights (hue lights) when I press my xiaomi button. The zigbee devices are controlled with zigbee2mqtt.
- alias: toggle office lights
trigger:
platform: mqtt
topic: 'zigbee2mqtt/office_button'
condition:
condition: template
value_template: "{{ 'single' == trigger.payload_json.click }}"
action:
service: light.toggle
entity_id: group.office
So far, I created this flow, but it doesn’t work:
[
{
"id": "a283654c.0ac178",
"type": "mqtt in",
"z": "e5271cb8.c38fd",
"name": "Office button",
"topic": "zigbee2mqtt/office_button",
"qos": "2",
"broker": "fc8e76a0.5ba218",
"x": 110,
"y": 80,
"wires": [
[
"6873eb4e.37ae04"
]
]
},
{
"id": "6873eb4e.37ae04",
"type": "switch",
"z": "e5271cb8.c38fd",
"name": "Click type",
"property": "payload_json.click",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "single",
"vt": "str"
},
{
"t": "eq",
"v": "double",
"vt": "str"
},
{
"t": "eq",
"v": "long_click_press",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 320,
"y": 80,
"wires": [
[
"26543ec5.b6ff92"
],
[],
[]
]
},
{
"id": "26543ec5.b6ff92",
"type": "api-call-service",
"z": "e5271cb8.c38fd",
"name": "Toggle office lights",
"server": "ed7d5529.e1f368",
"service_domain": "light",
"service": "toggle",
"data": "{\"entity_id\":\"group.office\"}",
"render_data": false,
"mergecontext": "",
"output_location": "payload",
"output_location_type": "msg",
"x": 590,
"y": 80,
"wires": [
[]
]
},
{
"id": "fc8e76a0.5ba218",
"type": "mqtt-broker",
"z": "",
"name": "HA/Mosquitos",
"broker": "(redacted)",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "ed7d5529.e1f368",
"type": "server",
"z": "",
"name": "Home Assistant"
}
]