Troubles setting up zigbee button in Node-Red

Hello all, I’ve been using nodered for about 2 weeks now and love it for HA. I’ve trying to add in a zigbee button, and I’m not seeing how to do this.

I’ve gone to developer settings and listened to “zha_event” and on a single click this is the event I get:

Event 0 fired 2:20 PM:
{
    "event_type": "zha_event",
    "data": {
        "unique_id": "0xde01:1:0x0006",
        "device_ieee": "84:18:26:00:00:e9:09:b2",
        "command": "on",
        "args": []
    },
    "origin": "LOCAL",
    "time_fired": "2019-08-17T18:20:02.325620+00:00",
    "context": {
        "id": "107549b48992485b988dd112d5df558b",
        "parent_id": null,
        "user_id": null
    }
}

I have no idea how to apply this in Node Red. I have a Event State node listening for “zha_event”. I place a debug node behind it and press the button and get this:

object
event_type: "zha_event"
topic: "zha_event"
payload: object
event_type: "zha_event"
event: object
unique_id: "0xde01:1:0x0006"
device_ieee: "84:18:26:00:00:e9:09:b2"
command: "on"
args: array[0]
_msgid: "bb85fcbc.4ef0e"

I know that I need to put this into a switch node, but I’m not sure how to plug this in.

Connect the Event State to a switch node to filter which button the event originated from set the property to payload.event.device_ieee then add a rule for your device_ieee.

if your device has different click types you will need a second switch for payload.event.command.

6 Likes

I forgot to report back and tell you thanks, I was able to get it working with your instructions.

1 Like

Would be ever so kind as to give some more details,
I have a Samsung Smartthings button (zigbee) that I am trying to setup in Node Red but cannot for the life of me figure it out.
I managed to get it to recognize the zha_event but I am stuck on what to do next to make a switch that will toggle a light on/off

Thanks in advance

I was able to use this to solve setting up a Hue Dimmer Switch. If anyone is curious about how this is done, here is my Flow:

Device Switch:

Button Switch:

6 Likes

In case you haven’t figured this out:

I did get it figured out but thank you for taking the time to reply.

Now I’m working on an IKEA remote lol

1 Like

I think it’s been nearly a year; but I figured that I would try - at least for anyone else that ran into this.

I needed some help understanding it; so when I solved it I shared my learns! :smiley:

1 Like

what is configured in you’re Zha-event (blue)

Does this help?

This is just catching all zha_events - if I want to expand in the future, this makes it easy. I then have a switch node to expand when I have additional switches to add which uses the IEEE serial number from the device that sent the zha_event event.

Currently this has just one; but adding more devices is easy by adding in the serial number to any additional switches or etc.

3 Likes

thnx , yes, that’s really helpful

If you run into any more troubles; let me know and I will do my best to help!

Do you have any troubles with NR not receiving ZHA events after a few days? I have two HA instances running, and my backup one that lives on a Rpi4 stops showing ZHA events in NR but they are in fact being received in HA

I personally haven’t noticed anything related happening in my instance.

Great, this helped me a lot.
Thanks !

1 Like