Using zigbee2mqtt with Node Red?

I set up a zigbee2mqtt dongle according to this tutorial:

It worked well and I was able to pair a Sonoff Motion Sensor and Door Switch and I can see them working on the Lovelace dashboard.

I want to use them with HA - preferably using Node Red, but find that it’s not as straightforward as I anticipated. I installed the node ‘node-red-contrib-zigbee2mqtt’, hoping that it would help, but am having difficulty understanding it. (Maybe I finally need to ‘grasp the bull by the horns’ and get to grips with mqtt!)

To give me a start, I’d like to see a flow using the motion sensor to switch on a lamp - or any other simple flow, and would be grateful for any assistance, please.
Jim

I’m not sure that I understand what it is that you are asking. It seems to me that you already have the prerequisites to get some automations going with Node Red. (Are you using the Node Red add-on within HA, or externally?)

If you Are using Node Red within HA, then you need to add the HA palette to Node Red and from there the rest is pretty easy. Have you added the palette yet?

Digiblur has some good info here Just skip to 1:10 for instructions on how to install the palette.

If your installed devices are showing up in Lovelace then you should be able to find the entities and their states under the “developer” tab of HA. These help you configure the various nodes to do what you want them to do.

Without knowing where you are at it is a little hard to be more specific.

1 Like

Panic over!
I’d made my mind up that I was going to encounter problems with zigbee2mqtt - installation of the ‘dongle’ and integrating it with HA seemed just too easy. So when I couldn’t find the device entities I thought ‘I need some help here’. The problem was that in the Node Red node configurations I was starting to type the device name (eg ‘eW…’) expecting autocompletion to show up the devices - but they didn’t! I of course should have been using the entity names (eg ‘binary…’). When I did so they showed up and I was able to use them.

Thanks for your help ‘Russ’ (and sorry to the forum for the ‘noise’!)
Jim

1 Like

Just so you know, you can catch mqtt payloads directly from NodeRed, no need for node-red zigbee node:

[{"id":"93fcc754.afaf08","type":"tab","label":"RF Remote MQTT","disabled":false,"info":"Sonof RF 8 channel Remote control"},{"id":"f6005625.9fca88","type":"mqtt in","z":"93fcc754.afaf08","name":"RF Bridge 1","topic":"TasmotaBRG1/tele/RESULT","qos":"2","datatype":"auto","broker":"f90cfe3b.a8bd7","x":90,"y":260,"wires":[["ec5f4e71.2f17d","9c9cec88.f1a41","71d96860.9bd7e8","f0ddb83c.1c7f78","3006b088.8b625","e98c1252.c569","afaac8ec.9062b8","4cf74af1.fa9aa4"]]},{"id":"41005807.3f41e8","type":"api-call-service","z":"93fcc754.afaf08","name":"TV room ceiling","server":"37d68302.2aabcc","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"light.tv_room_ceiling","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":480,"y":60,"wires":[[]]},{"id":"ec5f4e71.2f17d","type":"switch","z":"93fcc754.afaf08","name":"D7E798","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E798","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":300,"y":60,"wires":[["41005807.3f41e8"]]},{"id":"9c9cec88.f1a41","type":"switch","z":"93fcc754.afaf08","name":"D7E794","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E794","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":300,"y":180,"wires":[["f739cefe.ebbcc"]]},{"id":"b40be53.0efd018","type":"api-call-service","z":"93fcc754.afaf08","name":"TV room couch","server":"37d68302.2aabcc","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"light.light_tv_room_couch","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":480,"y":120,"wires":[[]]},{"id":"f739cefe.ebbcc","type":"api-call-service","z":"93fcc754.afaf08","name":"TV room side","server":"37d68302.2aabcc","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"light.light_tv_room_side","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":470,"y":180,"wires":[[]]},{"id":"60a2cf1.c80083","type":"api-call-service","z":"93fcc754.afaf08","name":"Living ceiling","server":"37d68302.2aabcc","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"light.living_ceiling","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":470,"y":240,"wires":[[]]},{"id":"24023bb0.683684","type":"api-call-service","z":"93fcc754.afaf08","name":"Living side","server":"37d68302.2aabcc","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"light.light_living_side","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":460,"y":300,"wires":[[]]},{"id":"4855e1bc.81169","type":"api-call-service","z":"93fcc754.afaf08","name":"Bar","server":"37d68302.2aabcc","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"light.bar","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":450,"y":360,"wires":[[]]},{"id":"1600b5a9.f20cfa","type":"api-call-service","z":"93fcc754.afaf08","name":"Kitchen","server":"37d68302.2aabcc","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"light.kitchen","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":460,"y":420,"wires":[[]]},{"id":"3aa1290c.700c26","type":"api-call-service","z":"93fcc754.afaf08","name":"Kitchen windows","server":"37d68302.2aabcc","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"toggle","entityId":"light.light_kitchen_window","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":480,"y":480,"wires":[[]]},{"id":"71d96860.9bd7e8","type":"switch","z":"93fcc754.afaf08","name":"D7E799","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E799","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":300,"y":240,"wires":[["60a2cf1.c80083"]]},{"id":"f0ddb83c.1c7f78","type":"switch","z":"93fcc754.afaf08","name":"D7E792","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E792","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":300,"y":300,"wires":[["24023bb0.683684"]]},{"id":"3006b088.8b625","type":"switch","z":"93fcc754.afaf08","name":"D7E795","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E795","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":300,"y":360,"wires":[["4855e1bc.81169"]]},{"id":"e98c1252.c569","type":"switch","z":"93fcc754.afaf08","name":"D7E791","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E791","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":300,"y":420,"wires":[["1600b5a9.f20cfa"]]},{"id":"afaac8ec.9062b8","type":"switch","z":"93fcc754.afaf08","name":"D7E793","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E793","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":300,"y":480,"wires":[["3aa1290c.700c26"]]},{"id":"4cf74af1.fa9aa4","type":"switch","z":"93fcc754.afaf08","name":"D7E79C","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E79C","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":300,"y":120,"wires":[["b40be53.0efd018"]]},{"id":"f90cfe3b.a8bd7","type":"mqtt-broker","z":"","name":"","broker":"192.168.0.9","port":"1883","clientid":"node-red","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"37d68302.2aabcc","type":"server","z":"","name":"Home Assistant"}]

This node toggles 8 lights :wink:

2 Likes

Thanks ‘aceindy’. I’ll have a look at it and no doubt learn a lot.

im

The snippet catches the buttons from an 8 channel RF remote, and toggles 8 lights