Hi - I’ve got plenty of HA automations, but want to migrate over to node red as I find that has more scope. It’s also a little more reliable for time based triggers.
I have a load of zigbee (Aqara) sensors and buttons. I created an event listener for the ZHA event. I then have a switch for the ID of the device to see which sent the command.
Is this the correct way of doing it? I will be adding a lot more sensors in the coming weeks and would rather get it right from the beginning.
That is one way.
You can also use a function node if you find that easier. That means you code your way to get where the message should go.
That means you could condense the sequence to “blue nodes” (ZHA Event, and call services) and just the function node in between with multiple outputs.
It will make the sequence smaller, but depending on your preference perhaps harder to interpret/debug and follow.
You could also use more ZHA Event nodes.
That way you could split them better between lounge and Emily selector.
This is exactly how I am handling my ZigBee buttons. Works well, allowing me to separate single press, double press and hold event triggers. I usually have flows triggered by these for all buttons in the house.
I thought this would be more help than the raw node-red flow code itself as it helps show the logic and 2 different device cases. I have a total of 6 buttons that are a part of the entire flow, the 6 IEEE identifiers in the first switch node, all using the same logic.
I have a simplified version in a short pdf. Not sure how I can post the file - if you know a way, let me know and I will share it. Otherwise, posting the images will likely have the same resolution problem.
I also have a JSON of the entire flow that this simplified version of my Button Inputs Flow is puuled from. It has all the nodes and the shenanigans that I use to accomplish what I want.