Aqara switch trigger a nodeRed action

I have been trying to follow multiple strings though the forums to make this work, but either I don’t understand them or things have changed.

I have aqara push button switch. The only entity I get for it is the power. I can intercept it in nodered with a events: all with the Event type set to zha_event. I listened to the even in the developer tools and this is what I got for a double press.

‘’’
{
“event_type”: “zha_event”,
“data”: {
“device_ieee”: “00:15:8d:00:02:7b:ee:59”,
“unique_id”: “00:15:8d:00:02:7b:ee:59:1:0x0012”,
“device_id”: “dafa6272e1de18e5e345ca70394a399b”,
“endpoint_id”: 1,
“cluster_id”: 18,
“command”: “double”,
“args”: {
“value”: 2
}
},
“origin”: “LOCAL”,
“time_fired”: “2021-01-30T21:25:11.943403+00:00”,
“context”: {
“id”: “4f18f83130d3fea372baa18c00d6ed4e”,
“parent_id”: null,
“user_id”: null
}
}
‘’’
When I add a debug node to my nodered, I get a line that says

'zha_event : msg.payload : Object ’

followed by a series of data names and values, that match the listen output.

It seems that unique_id: is a good thing to use to figure out the switch used, and then the args: to figure out what was pushed. But I can’t figure out what to put in the switch box to be able to pull out that information and test it.

If there is no easy way to get this info pulled out, I guess another possibility would be to pass it in from Home Assistant. Never done that before so would have to figure it out, but if that is the only way, I can head down that path. But would much prefer it in nodered.
I am new to Home Assistant and newer to nodered. I have been working on this for several days and just cant get past it.

Thanks for any help

please share a screenshot of the debug node output in nodered.

https://gyazo.com/5be623ca27eb315ad6e7a3da5c40d58d

To check the device_id you can put this in the property of the switch node.

payload.event.device_id

To check the unique_id you can put this in the property of the switch node.

payload.event.unique_id

To check the command, you can put this.

payload.event.command
1 Like

Thanks, tried that but wasn’t sure what to compare it against. An a-z, msg? tried a bunch and none seem to work Sorry, I’m reveling how much I don’t know.

Never mind, I got it, though I had tried a-z but must have had something wrong. Thank you for the help.

1 Like