Node-Red and ZWave Scenes

I have only played a little with Node-Red so far but wouldn’t be easier to to have a node that supplies all events to a function node (or similar) that only sends out the events that you want to use?

Basically an event filter.

Yes yes yes!! I am trying to do just that! What is this magic event filter node you speak of? I have the node that supplies all events and I know which event I want, but I can’t find the event filter node.

Edit: Alright I have copied the exact payload from my debug of the “allevents” node and pasted it into a switch node to match exactly. This way it should only allow the flow to continue if the exact event is triggered. Unfortunately, when I press my minimote button I can see the event is triggered with my debug node but it never passes the switch node and I don’t know why.

This is the copy/paste of the msg.payload by the way:

{“event_type”:“zwave.scene_activated”,“entity_id”:“zwave.aeotec_dsa03202_minimote”,“event”:{“entity_id”:“zwave.aeotec_dsa03202_minimote”,“node_id”:5,“scene_id”:1}}

Could you show me how to properly setup my switch node to let only this event pass?

In the switch node you need set Property to: msg.payload.entity_id
and node properties to: == zwave.aeotec_dsa03202_minimote
and next switch node for scene_id property msg.payload.scene_id node properties == 1

Take a look at my thread here - I have done exactly what you are after.

Ah its msg.payload.EVENT.scene_id lol I was leaving out the event part and nothing was going through. Thanks so much! Side Note: I am trying to have a couple of my buttons toggle lights but when I press them the light toggles off but then right back on again. Have you experienced this before? Maybe my Node-Red automation is triggering twice in quick succession for some reason?

Hi,

Try putting debug nodes along the flow to see if the node-red automation is being triggered twice and where exactly it is making it past the filter.

Not seen this myself personally. Stupid question, but have you left the HomeAssistant automation enabled too ?

Maybe…crap. Lets not speak of this again.

I realize this is pretty old but I’ve recently been moving my automations to NR and trying to figure out decent and non messy logic to handle Z-Wave scenes with my inovelli switches. Currently I only have 1 switch that can trigger scenes but I intend on adding more. Looking at the event data, the main things are msg.payload.event.node_id which is the actual Z-Wave node, msg.payload.event.scene_id which is either a 1 or a 2 (1 are all down switch presses, 2’s are up switch presses), and msg.payload.event.scene_data, which the ones I’m concerned with are 3, 4, 5, 6 where 3 is double press, 4 is triple press, etc. I’d like to set up something where I won’t need a whole ton of nodes to get the job done, but I have a nasty feeling there’s little option for that.

Right now I have a series of switch nodes set up, the first to decide on scene_id (1 or 2), then two switches each with 4 outputs based on the scene_data. The output of the scene data switches are then linked to a HA service call to control the lights.

Like I said, I’d eventually like to add another scene enabled switch and realize that I’d have to either duplicate the setup or try to find a better way to handle the logic.

Well, for now I turned the 3 switches into a subflow. At least it’ll make it a little nicer and easier to implement for future switches.

I did a small function that concatenate data + id so it’s easier to manage. I guess you could also add another zwave switch id to manage all scenes with only NR switch node.

var ID = (msg.payload.event.scene_data).toString() + (msg.payload.event.scene_id).toString()
msg.payload = ID
return msg;

Hey there,

I’m trying to do the same thing. Could you paste an example of your JSON? I’m having a heck of a time trying to figure it out from screen shots.

Thanks!

Hopefully this will help. Below is the subflow I created to handle the scenes.

[{"id":"8bbb84eb.bdfcd8","type":"subflow","name":"Inovelli Scenes","info":"","category":"","in":[{"x":120,"y":220,"wires":[{"id":"b730e51e.fbb038"}]}],"out":[{"x":620,"y":60,"wires":[{"id":"d8379d0.d18406","port":0}]},{"x":620,"y":100,"wires":[{"id":"d8379d0.d18406","port":1}]},{"x":620,"y":140,"wires":[{"id":"d8379d0.d18406","port":2}]},{"x":620,"y":180,"wires":[{"id":"d8379d0.d18406","port":3}]},{"x":620,"y":240,"wires":[{"id":"efedc958.a57f78","port":0}]},{"x":620,"y":280,"wires":[{"id":"efedc958.a57f78","port":1}]},{"x":620,"y":320,"wires":[{"id":"efedc958.a57f78","port":2}]},{"x":620,"y":360,"wires":[{"id":"efedc958.a57f78","port":3}]}],"outputLabels":["Double tap down","Triple tap down","Quad tap down","5 taps down","Double tap up","Triple tap up","Quad Tap up","5 taps up"]},{"id":"b730e51e.fbb038","type":"switch","z":"8bbb84eb.bdfcd8","name":"Scene ID","property":"payload.event.scene_id","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":260,"y":220,"wires":[["d8379d0.d18406"],["efedc958.a57f78"]]},{"id":"d8379d0.d18406","type":"switch","z":"8bbb84eb.bdfcd8","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":180,"wires":[[],[],[],[]],"outputLabels":["Double Tap Down","Triple Tap Down","Quad Tap Down","5 Tap Down"]},{"id":"efedc958.a57f78","type":"switch","z":"8bbb84eb.bdfcd8","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":260,"wires":[[],[],[],[]],"outputLabels":["Double Tap Up","Triple Tap Up","Quad Tap Up","5 Tap Up"]}]

Below is what it would look like used in an actual flow (minus the connections to the service call I’m using). Basically you filter all events by zwave scene activated, route the message using a switch to determine which zwave node it’s on, place the subfunction after that, which you can then select what you want it to do on the outputs. Hopefully this helps. I’m not that great with NR and I’m sure there’s probably a better way to do this.

[{"id":"8bbb84eb.bdfcd8","type":"subflow","name":"Inovelli Scenes","info":"","category":"","in":[{"x":120,"y":220,"wires":[{"id":"b730e51e.fbb038"}]}],"out":[{"x":620,"y":60,"wires":[{"id":"d8379d0.d18406","port":0}]},{"x":620,"y":100,"wires":[{"id":"d8379d0.d18406","port":1}]},{"x":620,"y":140,"wires":[{"id":"d8379d0.d18406","port":2}]},{"x":620,"y":180,"wires":[{"id":"d8379d0.d18406","port":3}]},{"x":620,"y":240,"wires":[{"id":"efedc958.a57f78","port":0}]},{"x":620,"y":280,"wires":[{"id":"efedc958.a57f78","port":1}]},{"x":620,"y":320,"wires":[{"id":"efedc958.a57f78","port":2}]},{"x":620,"y":360,"wires":[{"id":"efedc958.a57f78","port":3}]}],"outputLabels":["Double tap down","Triple tap down","Quad tap down","5 taps down","Double tap up","Triple tap up","Quad Tap up","5 taps up"]},{"id":"b730e51e.fbb038","type":"switch","z":"8bbb84eb.bdfcd8","name":"Scene ID","property":"payload.event.scene_id","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":260,"y":220,"wires":[["d8379d0.d18406"],["efedc958.a57f78"]]},{"id":"d8379d0.d18406","type":"switch","z":"8bbb84eb.bdfcd8","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":180,"wires":[[],[],[],[]],"outputLabels":["Double Tap Down","Triple Tap Down","Quad Tap Down","5 Tap Down"]},{"id":"efedc958.a57f78","type":"switch","z":"8bbb84eb.bdfcd8","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":260,"wires":[[],[],[],[]],"outputLabels":["Double Tap Up","Triple Tap Up","Quad Tap Up","5 Tap Up"]},{"id":"5576c9d2.cd5438","type":"server-events","z":"f0044e54.7da15","name":"ZWave Scenes","server":"e3954b3c.8ebdc8","event_type":"zwave.scene_activated","x":80,"y":620,"wires":[["2a232a42.02b606"]]},{"id":"2a232a42.02b606","type":"switch","z":"f0044e54.7da15","name":"What Switch","property":"payload.event.node_id","propertyType":"msg","rules":[{"t":"eq","v":"6","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":620,"wires":[["34d38d52.497e02"]],"outputLabels":["Ericas Switch"]},{"id":"34d38d52.497e02","type":"subflow:8bbb84eb.bdfcd8","z":"f0044e54.7da15","name":"","x":440,"y":580,"wires":[["b60f11ec.bf857","f3d6da9.9723728"],["b60f11ec.bf857"],[],[],["332fcddb.1588c2","9f4279a6.a33dd8"],["332fcddb.1588c2"],[],[]]},{"id":"e3954b3c.8ebdc8","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true}]

Also, here’s what it looks like visually. The subflow:
subflow

How I use the subflow in the automation:
flowuse

3 Likes

Thanks SO much!

That got me going. Really appreciate it!

1 Like

I know this is an old post but credits due where credits due as this helped me also with the Aeotec Wallmote. Out of interest so that I can understand this better because I am just getting to know Nodered but did you use the sub flow just to keep things neat or was there a particular technical reason for it?

1 Like

I mainly used the subflow to keep things neat and easily reusable for future switches. I’m pretty sure there’s better ways to do it. But this is what worked for me so I just stopped trying to make it better :slight_smile:

Basically now I don’t really need to recreate the switching logic over and over for each switch with scene capabilities. All I need to do is edit the “what switch” switch to add another nodeid output and point its output to another subflow and connect those outputs to what I want it to do. Like I said, I’m almost positive this can be simplified more, but I’m certainly not great with coding.

I’m glad it worked for you though!

@paradinglunatic Thank you so much for this! With this as a template I was able to get my HS Dimmers going through Node Red!

1 Like

Thank you for this flow, I’m investing in a bunch of the Inovelli dimmers and this will make managing them way better in node-red vs HA. With your Flow in the scene_data node on the sub-flow, it just has a one-digit/number value. Would I need to override the scene_data with the specific four-digit one specific to each switch model? (See Example Below)

I believe so. So instead of 3, 4, 5, 6 for the scene Data you would do 7680, 7860, 7920, 7980, 8040, and so on…although probably won’t have to do 7680, since that’s single press which HA/NR should be able to pick up without using the codes, although you could code them in of you want.

Can you give me more 101 type hints on how you did this? in HA it works… but I need to work this out in NodeRed … i’ve read everything I can but need more novice walk throughs.