Node-Red and ZWave Scenes

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.

Here is the export from NodeRed, you will need to switch the settings to your HASS instance, the yellow switch and the output nodes. In this case I’m only using two output nodes.

[{"id":"e0170ce8.fa7a58","type":"subflow","name":"HS 100 Dimmer Scenes","info":"","category":"","in":[{"x":120,"y":220,"wires":[{"id":"8297af3c.988b6"}]}],"out":[{"x":620,"y":60,"wires":[{"id":"d9a4564d.7ad7f","port":0}]},{"x":620,"y":100,"wires":[{"id":"d9a4564d.7ad7f","port":1}]},{"x":620,"y":140,"wires":[{"id":"d9a4564d.7ad7f","port":2}]},{"x":620,"y":180,"wires":[{"id":"d9a4564d.7ad7f","port":3}]},{"x":620,"y":240,"wires":[{"id":"2b06bd7f.980cf2","port":0}]},{"x":620,"y":280,"wires":[{"id":"2b06bd7f.980cf2","port":1}]},{"x":620,"y":320,"wires":[{"id":"2b06bd7f.980cf2","port":2}]},{"x":620,"y":360,"wires":[{"id":"2b06bd7f.980cf2","port":3}]}],"env":[],"outputLabels":["Single tap on","Double tap on","Triple tap on","Tap and hold on","Single tap off","Double tap off","Triple tap off","Tap and hold off"]},{"id":"8297af3c.988b6","type":"switch","z":"e0170ce8.fa7a58","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":[["d9a4564d.7ad7f"],["2b06bd7f.980cf2"]]},{"id":"d9a4564d.7ad7f","type":"switch","z":"e0170ce8.fa7a58","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":180,"wires":[[],[],[],[]],"outputLabels":["Single tap on","Double tap on","Triple tap on","Tap and hold on"]},{"id":"2b06bd7f.980cf2","type":"switch","z":"e0170ce8.fa7a58","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":260,"wires":[[],[],[],[]],"outputLabels":["Single tap off","Double tap off","Triple tap off","Tap and hold off"]},{"id":"8e016187.d2dd38","type":"api-call-service","z":"27863c3f.28956c","name":"Offce light on","server":"db6dabc2.b30178","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"light.lights_office\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":835,"y":204,"wires":[[]]},{"id":"7cf3dc58.8477dc","type":"api-call-service","z":"27863c3f.28956c","name":"Office lights off","server":"db6dabc2.b30178","service_domain":"light","service":"turn_off","data":"{\"entity_id\":\"light.lights_office\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":835,"y":384,"wires":[[]]},{"id":"9cde9b8b.c1a028","type":"comment","z":"27863c3f.28956c","name":"Instructions!","info":"Only need to change the yellow switch and the outputs.","x":127.5,"y":151,"wires":[]},{"id":"d91e13e0.5cad48","type":"server-events","z":"27863c3f.28956c","name":"ZWave Scenes","server":"db6dabc2.b30178","event_type":"zwave.scene_activated","x":137,"y":319,"wires":[["bef4c632.882be8"]]},{"id":"bef4c632.882be8","type":"switch","z":"27863c3f.28956c","name":"Office Dimmer","property":"payload.event.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"zwave.lights_office","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":317,"y":319,"wires":[["d3da6ba4.e6b2f"]],"outputLabels":["Ericas Switch"]},{"id":"d3da6ba4.e6b2f","type":"subflow:e0170ce8.fa7a58","z":"27863c3f.28956c","name":"","env":[],"x":545,"y":319,"wires":[["8e016187.d2dd38"],[],[],[],["7cf3dc58.8477dc"],[],[],[]]},{"id":"db6dabc2.b30178","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"}]

And here’s the subflow node if it didn’t come through with the above.

[{"id":"8297af3c.988b6","type":"switch","z":"e0170ce8.fa7a58","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":[["d9a4564d.7ad7f"],["2b06bd7f.980cf2"]]},{"id":"d9a4564d.7ad7f","type":"switch","z":"e0170ce8.fa7a58","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":180,"wires":[[],[],[],[]],"outputLabels":["Single tap on","Double tap on","Triple tap on","Tap and hold on"]},{"id":"2b06bd7f.980cf2","type":"switch","z":"e0170ce8.fa7a58","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":260,"wires":[[],[],[],[]],"outputLabels":["Single tap off","Double tap off","Triple tap off","Tap and hold off"]}]

Lastly, keep in mind I’m using first gen HS dimmers. If you’re using the newer 2nd gen you will need to update the dimmer scene numbers.

Thanks for replying… someones already contributed to it. Searching for nodered inovelli things i found this… which includes the scene ID and scene data and explains why the button down (Scene Id = 1) and button up (Scene id == 2) scenes are organised how they are. Genius!


nodered subflow for switches with scene id and data parameters

1 Like

Hi folks from the future.

Here is an updated scene subflow for Openzwave for the Inovelli Red Dimmer. I also swapped outputs to up would be on top. Cheers.

keywords: ozw, LZW31-SN

[{"id":"8411e384.fb1f9","type":"subflow","name":"Inovelli Scenes","info":"","category":"","in":[{"x":120,"y":220,"wires":[{"id":"1adf8d0e.cac7f3"}]}],"out":[{"x":680,"y":40,"wires":[{"id":"3faf3597.ea43ba","port":0}]},{"x":680,"y":80,"wires":[{"id":"3faf3597.ea43ba","port":1}]},{"x":680,"y":120,"wires":[{"id":"3faf3597.ea43ba","port":2}]},{"x":680,"y":160,"wires":[{"id":"3faf3597.ea43ba","port":3}]},{"x":680,"y":200,"wires":[{"id":"3faf3597.ea43ba","port":4}]},{"x":680,"y":240,"wires":[{"id":"eee43bc5.cec848","port":0}]},{"x":680,"y":280,"wires":[{"id":"eee43bc5.cec848","port":1}]},{"x":680,"y":320,"wires":[{"id":"eee43bc5.cec848","port":2}]},{"x":680,"y":360,"wires":[{"id":"eee43bc5.cec848","port":3}]},{"x":680,"y":400,"wires":[{"id":"eee43bc5.cec848","port":4}]},{"x":680,"y":440,"wires":[{"id":"7247d146.a727a","port":0}]}],"env":[],"color":"#DDAA99","outputLabels":["Single tap up","Double tap up","Triple tap up","Quad tap up","5 taps up","Single tap down","Double tap down","Triple tap down","Quad Tap down","5 taps down","Config tap"]},{"id":"1adf8d0e.cac7f3","type":"switch","z":"8411e384.fb1f9","name":"Scene ID","property":"payload.event.scene_id","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"3","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":260,"y":220,"wires":[["eee43bc5.cec848"],["3faf3597.ea43ba"],["7247d146.a727a"]]},{"id":"eee43bc5.cec848","type":"switch","z":"8411e384.fb1f9","name":"Scene Value (Down)","property":"payload.event.scene_value_id","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"},{"t":"eq","v":"7","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":460,"y":260,"wires":[[],[],[],[],[]],"outputLabels":["Single Tap Down","Double Tap Down","Triple Tap Down","Quad Tap Down","5 Tap Down"]},{"id":"3faf3597.ea43ba","type":"switch","z":"8411e384.fb1f9","name":"Scene Value (Up)","property":"payload.event.scene_value_id","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"},{"t":"eq","v":"7","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":450,"y":180,"wires":[[],[],[],[],[]],"outputLabels":["Single Tap Up","Double Tap Up","Triple Tap Up","Quad Tap Up","5 Tap Up"]},{"id":"7247d146.a727a","type":"switch","z":"8411e384.fb1f9","name":"Scene Value (Config)","property":"payload.event.value_id","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":460,"y":320,"wires":[[]],"outputLabels":["Single Config Tap"]}]

Why dont I have a zwave.scene_activated?

For anyone looking for updates, it looks like discussion has been moved to [TIP] Home Assistant + Node-Red Scene Manager - Digital Lounge - Inovelli Community

Thanks guys this helped a lot. I found I can use the debug node to copy the path for the triple filter.
Switch node msg.payload.event.node_id
== the node number in debug
Switch node msg.payload.event.label
== scene in the debug window
Switch node msg.payload.event.value
== value in the debug ie Keypressed2X

These 3 nodes will filter out all the rest of the scenes. I just found out most wall switches have double pressed scene triggers built in.

Again. Thanks for getting the ball rolling.