Access multi-button presses for Blue switches in Node Red (Zigbee2MQTT)

Hello, everyone… I’ve searched all over the place and I’m having a hard time figuring out how to access multi-button presses on the Inovelli Blue switch in Node Red so that I can set up scenes and/or automations that trigger when I double or triple (etc) press buttons on the switch.

I’ve played with the events: state node, the device node, and trigger: state nodes, hooked up to debug nodes, and the only response I get in the debug window are for on and off. I’m sure I’m missing something basic.

My current setup is that I have a raspberry pi 4 with Home Assistant installed. I’ve linked the switches to Home Assistant via Zigbee2MQTT. I have a mix of smart and dumb bulbs. I’ve bound the switches directly to the smart bulbs.

I can create basic automations in Node Red and can detect in node red when the switch is turned on or off. But I can’t figure out how to detect double presses, triples, etc. in Node Red.

I’m a newbie at this, so detailed answers would be very helpful for me. Thanks in advance for your help.

I stopped using node red prior to the blue’s, but I’d have probably used the zigbee2mqtt-in node out of the z2m pallete to accomplish this. You’ll have to open the pallete manager to add these nodes in.

node-red-contrib-zigbee2mqtt (node) - Node-RED (nodered.org)

There’s probably 3 or 4 other ways to do the same thing. Some other options would be the mqtt node or an event:all node (not generally recommended for resources). Somebody still using node-red should be able to help you further, but this should get you pointed in the right direction.

Not gonna be super helpful, but just wanted to throw the thing I did out there. I guess it creates a button entity in HA that triggers the flow when pressed.

I used this:

I guess it needs this custom integration.

I’m not super familiar with it as I only used it once and don’t really understand it.

It seems clunky as it makes a new config thing for each button it listens to?
image

Thanks for this. I did happen to find some information on the z2m palette. I installed it, but I was having trouble figuring out how to connect it to the mqtt server. I was not sure where to find the host IP address. I’ll explore this option further.

I have not played with the MQTT node. I’ll check it out.

This does seem like an option, but maybe a bit clunky? I think there’s a more streamlined approach out there because I’ve seen references to it, but never a detailed explanation on how to set it up! Thank you for the input… it gives me new realms to explore.

For those reading, I did find that, in node red, if I choose the “action” entity for the switch in the “events: state” node, the msg payload contains all of the various button presses. Now my goal is to figure out the most efficient way to set this up so I don’t have a spiderweb of nodes for each switch. Input on how to accomplish this would be much appreciated!

1 Like

OK, if you’ve got it reading the events, the next step is to run that event node into a switch node. Change msg.payload to whatever the location of the action event is, then add items for all of the possible options you want.

If you decide to go the z2m node route, the host would be the ip address of your HA server (assuming you’re using the z2m addon, not standalone). Topic is typically zigbee2mqtt, port 1883. Once you’ve setup the configuration node, when you drop in the z2m in node, you’ll get a drop down list of all your devices. Then you’ll run it into a switch node just like above.

In NR I use the mqtt in node and filter on the action. Note this requires you to setup the mqtt bridge node once.
image

image

Thanks, Stu… I got this working via the Z2M “in” node, but I’ll give this method a try, too. I’m not sure if there’s one that’ll be more reliable than the other. If you have any input on that, let me know!

Thanks,

Tony

1 Like

I realize I’m late on this, but I figure this might help for anyone who finds this in the future. I created a subflow that is housed in 1 node for all the actions. I posted about it in the Node Red section on the Home Assistant forum, but in case links are frowned upon, here is the json

Screenshot (107)

[{"id":"d4e34fc6555562b5","type":"subflow","name":"Inovelli VZM31 Scenes - Zigbee","info":"","category":"","in":[{"x":120,"y":280,"wires":[{"id":"efe3cef8d365396b"}]}],"out":[{"x":570,"y":20,"wires":[{"id":"efe3cef8d365396b","port":0}]},{"x":570,"y":60,"wires":[{"id":"efe3cef8d365396b","port":1}]},{"x":570,"y":100,"wires":[{"id":"efe3cef8d365396b","port":2}]},{"x":570,"y":140,"wires":[{"id":"efe3cef8d365396b","port":3}]},{"x":570,"y":180,"wires":[{"id":"efe3cef8d365396b","port":4}]},{"x":580,"y":220,"wires":[{"id":"efe3cef8d365396b","port":5}]},{"x":590,"y":260,"wires":[{"id":"efe3cef8d365396b","port":6}]},{"x":580,"y":300,"wires":[{"id":"efe3cef8d365396b","port":7}]},{"x":580,"y":340,"wires":[{"id":"efe3cef8d365396b","port":8}]},{"x":580,"y":380,"wires":[{"id":"efe3cef8d365396b","port":9}]},{"x":580,"y":420,"wires":[{"id":"efe3cef8d365396b","port":10}]},{"x":580,"y":460,"wires":[{"id":"efe3cef8d365396b","port":11}]},{"x":590,"y":500,"wires":[{"id":"efe3cef8d365396b","port":12}]},{"x":600,"y":540,"wires":[{"id":"efe3cef8d365396b","port":13}]}],"env":[],"meta":{},"color":"#3FADB5","inputLabels":["Zigbee2MQTT"],"outputLabels":["Up 1x","Up 2x","Up 3x","Up 4x","Up 5x","Up Held","Up Release","Down 1x","Down 2x","Down 3x","Down 4x","Down 5x","Down Held","Down  Release"]},{"id":"efe3cef8d365396b","type":"switch","z":"d4e34fc6555562b5","name":"Zigbee Scene Controller","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"up_single","vt":"str"},{"t":"eq","v":"up_double","vt":"str"},{"t":"eq","v":"up_triple","vt":"str"},{"t":"eq","v":"up_quadruple","vt":"str"},{"t":"eq","v":"up_quintuple","vt":"str"},{"t":"eq","v":"up_held","vt":"str"},{"t":"eq","v":"up_release","vt":"str"},{"t":"eq","v":"down_single","vt":"str"},{"t":"eq","v":"down_double","vt":"str"},{"t":"eq","v":"down_triple","vt":"str"},{"t":"eq","v":"down_quadruple","vt":"str"},{"t":"eq","v":"down_quintuple","vt":"str"},{"t":"eq","v":"down_held","vt":"str"},{"t":"eq","v":"down_release","vt":"str"}],"checkall":"true","repair":false,"outputs":14,"x":310,"y":280,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[]]},{"id":"8fae914c3a1ee6fb","type":"zigbee2mqtt-in","z":"5aa30db867948cc8","name":"Guest Room Fan Switch","server":"9559cd76559143ec","friendly_name":"Guest Room Fan Switch (VZM31-SN)","device_id":"0xb43a31fffe2f16a7","state":"action","outputAtStartup":true,"filterChanges":true,"enableMultiple":false,"x":130,"y":460,"wires":[["e63aa9d16e24c4c1"]]},{"id":"e63aa9d16e24c4c1","type":"subflow:d4e34fc6555562b5","z":"5aa30db867948cc8","name":"VZM31 Scenes","x":340,"y":460,"wires":[["3e7ed778f7159b9d"],["021db1ee7dfc3468"],["7531961dcd8a08ca"],[],[],[],[],["a518a93868b3ad1a"],[],[],[],[],[],[]]},{"id":"9559cd76559143ec","type":"zigbee2mqtt-server","name":"MQTT Server","host":"127.0.0.1:1883","mqtt_port":"1883","mqtt_username":"teter09","mqtt_password":"Wrjvt*0603ha","mqtt_qos":"0","tls":"","usetls":false,"base_topic":"zigbee2mqtt"}]