Now I want to take an action based on what switch was double-pressed using Node_ID.
I can write a trigger for every single light switch, which seems awful, but I have tested it using 3 switches and it works.
Ideally, I’d like to use CHOOSE and depending on the NODE_ID (the specific switch) take different actions. How would I do this?
Node_ID is an element of event_data, but I’m not sure how I evaluate it in the CHOOSE statement.
If you use an event trigger, the trigger variable will contain the event data which will therefore include the node ID.
So in a template condition inside a choose block you could use {{ trigger.event.data.node_id | int(0) == 25 }} to check if it is node 25.
To verify what the trigger data looks like, trigger the automation by double-tapping a switch and then look at the automation trace. The “changed variables” section will show what was in the trigger variable.
Thanks for the response.
This method works, but it isn’t the path I want to take.
Since I already know the node_id as part of the zwave payload, it seems easier to me to create an evaluation at the CHOOSE instead of creating separate triggers and still create an evaluation at the CHOOSE.
Hope that makes sense.