[TIP] Home Assistant + Node-Red Scene Manager

Found this on the Home Assistant forums, and figured it should be copied here for easier visbility.

The following is a subflow that make it a little cleaner to work with zwave scene events:

[{"id":"3f60e735.9db1a8","type":"subflow","name":"Inovelli Scenes","info":"","category":"","in":[{"x":120,"y":220,"wires":[{"id":"daee7611.539b78"}]}],"out":[{"x":620,"y":40,"wires":[{"id":"df8196c7.74b5c8","port":0}]},{"x":620,"y":80,"wires":[{"id":"df8196c7.74b5c8","port":1}]},{"x":620,"y":120,"wires":[{"id":"df8196c7.74b5c8","port":2}]},{"x":620,"y":160,"wires":[{"id":"df8196c7.74b5c8","port":3}]},{"x":620,"y":200,"wires":[{"id":"df8196c7.74b5c8","port":4}]},{"x":620,"y":240,"wires":[{"id":"28f99a5c.03f676","port":0}]},{"x":620,"y":280,"wires":[{"id":"28f99a5c.03f676","port":1}]},{"x":620,"y":320,"wires":[{"id":"28f99a5c.03f676","port":2}]},{"x":620,"y":360,"wires":[{"id":"28f99a5c.03f676","port":3}]},{"x":620,"y":400,"wires":[{"id":"28f99a5c.03f676","port":4}]},{"x":620,"y":440,"wires":[{"id":"6ed890f7.9c56e","port":0}]}],"env":[],"color":"#DDAA99","outputLabels":["Single tap down","Double tap down","Triple tap down","Quad tap down","5 taps down","Single tap up","Double tap up","Triple tap up","Quad Tap up","5 taps up","Config tap"]},{"id":"daee7611.539b78","type":"switch","z":"3f60e735.9db1a8","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":[["df8196c7.74b5c8"],["28f99a5c.03f676"],["6ed890f7.9c56e"]]},{"id":"df8196c7.74b5c8","type":"switch","z":"3f60e735.9db1a8","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"7680","vt":"str"},{"t":"eq","v":"7860","vt":"str"},{"t":"eq","v":"7920","vt":"str"},{"t":"eq","v":"7980","vt":"str"},{"t":"eq","v":"8040","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":430,"y":180,"wires":[[],[],[],[],[]],"outputLabels":["Single Tap Down","Double Tap Down","Triple Tap Down","Quad Tap Down","5 Tap Down"]},{"id":"28f99a5c.03f676","type":"switch","z":"3f60e735.9db1a8","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"7680","vt":"str"},{"t":"eq","v":"7860","vt":"str"},{"t":"eq","v":"7920","vt":"str"},{"t":"eq","v":"7980","vt":"str"},{"t":"eq","v":"8040","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":430,"y":260,"wires":[[],[],[],[],[]],"outputLabels":["Single Tap Up","Double Tap Up","Triple Tap Up","Quad Tap Up","5 Tap Up"]},{"id":"6ed890f7.9c56e","type":"switch","z":"3f60e735.9db1a8","name":"Scene Data","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"7680","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":320,"wires":[[]],"outputLabels":["Single Config Tap"]}]

I made a few modifications the original adding labels and possibly correcting scene ID’s (don’t remember for sure). The intention is to use it with an “Events: all” node set to Event Type “zwave.scene_activated” with the resulting message passed to a switch node looking at property “msg.payload.event.node_id”, with the output dependent on the ID of the switch activated. (i.e. ==6 if the switch is node 6)

Credit to this post

3 Likes

can you give me some tips on how to implement this into my nodered? novice here drowning in the deep end of the kiddie pool

Under the menu, select import, and past the code in, selecting if you want it in your current flow or a new one. Pretty sure that’s all, but it’s been awhile, and testing it wasn’t working for me (thought I think that’s because mine is already in my library).


Node red definitely has a steep learning curve, but feels way more powerful for complicated automatons than the default HA one.

Thanks for that. Makes sense why people post nodered json text I honestly thought people were reading them like error log.
While I was waiting for a reply i found https://flows.nodered.org/node/node-red-contrib-inovelli-nodes which has the scene id and scene data input in…

This sub-flow handles click count and everything already, just have to set up the front end to listen to the right zwave node, after that each output corresponds to a specific up or down press (hovering over each output should tell you which one it represents).

It’s genius. I’m trying to workout how for the switch to talk to node red now… a little stuck.

Under the “Watch Switch” node in his sequence what info would be in the msg?
I assume “entity id and node id”? could you help me what to put there? my switch is node 2

Assuming you meant “what switch” node.
You’d put “2” in instead of my first “10”, making sure other options leading before that match, and delete all the other output options. That node becomes important once you have more than one switch. With a single switch, it would technically work without that node.

I’m about to have 13 of these switches…

Thanks… That worked perfectly. i’m blown away really. Can you tell me why you have so many switches setup in that picture? 4 switches connected to run a combined scene in multiple rooms?

Just keeping all of my switch scenes managed on one flow. I figured only having one event:all listener node versus 4 probably saves resources.

Also makes it so I can have different scenes depending on the location of the switch. (the config in the kitchen triggers max light level instead of default, config in the master suite toggles the bathroom heater, etc).

That makes sense. The more I learn the easier this gets. Thanks for taking the time.

1 Like

Dropping this here. If you upgrade to home assistants new ozw integration. This is the updated subflow you will need to use

[{"id":"73fde49d.94267c","type":"subflow","name":"Inovelli Scenes","info":"","category":"","in":[{"x":120,"y":220,"wires":[{"id":"3c99d4a9.b3bac4"}]}],"out":[{"x":620,"y":40,"wires":[{"id":"60d0a2f1.4599fc","port":0}]},{"x":620,"y":80,"wires":[{"id":"60d0a2f1.4599fc","port":1}]},{"x":620,"y":120,"wires":[{"id":"60d0a2f1.4599fc","port":2}]},{"x":620,"y":160,"wires":[{"id":"60d0a2f1.4599fc","port":3}]},{"x":620,"y":200,"wires":[{"id":"60d0a2f1.4599fc","port":4}]},{"x":620,"y":240,"wires":[{"id":"4ce397c.b363ce8","port":0}]},{"x":620,"y":280,"wires":[{"id":"4ce397c.b363ce8","port":1}]},{"x":620,"y":320,"wires":[{"id":"4ce397c.b363ce8","port":2}]},{"x":620,"y":360,"wires":[{"id":"4ce397c.b363ce8","port":3}]},{"x":620,"y":400,"wires":[{"id":"4ce397c.b363ce8","port":4}]},{"x":620,"y":440,"wires":[{"id":"19e6265b.f924ea","port":0}]}],"env":[],"color":"#DDAA99","outputLabels":["Single tap down","Double tap down","Triple tap down","Quad tap down","5 taps down","Single tap up","Double tap up","Triple tap up","Quad Tap up","5 taps up","Config tap"]},{"id":"3c99d4a9.b3bac4","type":"switch","z":"73fde49d.94267c","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":[["60d0a2f1.4599fc"],["4ce397c.b363ce8"],["19e6265b.f924ea"]]},{"id":"60d0a2f1.4599fc","type":"switch","z":"73fde49d.94267c","name":"Scene Value","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":430,"y":180,"wires":[[],[],[],[],[]],"outputLabels":["Single Tap Down","Double Tap Down","Triple Tap Down","Quad Tap Down","5 Tap Down"]},{"id":"4ce397c.b363ce8","type":"switch","z":"73fde49d.94267c","name":"Scene Value","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":430,"y":260,"wires":[[],[],[],[],[]],"outputLabels":["Single Tap Up","Double Tap Up","Triple Tap Up","Quad Tap Up","5 Tap Up"]},{"id":"19e6265b.f924ea","type":"switch","z":"73fde49d.94267c","name":"Scene Value","property":"payload.event.scene_value_id","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":320,"wires":[[]],"outputLabels":["Single Config Tap"]}]
7 Likes

Thanks! I have not made the switch but this will be useful later.

How did you guys see button presses in event.state? I’m struggling to have anything other than on/off pick up with a debug node showing all messages on the switches

@bgreet check out https://flows.nodered.org/node/node-red-contrib-inovelli-nodes

I think this node will give you the info you want. Works for all zwave.scene_activated events.

Probably a silly questions but I have this up and working and it occurred to me I might not fully understand it. I have like 15 of these switches and have configured the switch node. Lets say I want switch A, double tap up to turn on kitchen light and switch B, double tap up to turn on patio light. Both those light service calls are tied to output “double tap up”. So will either switch end up turning on both lights when I double tap? How do I route double tab from switch A to one light and double tap from switch B to another?

You’ll need a “switch node” before the sub-flow to sort out which switch is being pressed. If routed the Events straight to the sub-flow, then yes, every scene on every switch would be the same.

Yup, i figured it out. Each switch pipes into its own pink subflow node.

I tweaked the sub-flow from the top post. Specifically I added the ability to catch hold and release events, and added a status node. I also switched around the outputs because down was up, and up was down. :upside_down_face:

[{"id":"76cacb8d.f71ab4","type":"subflow","name":"Inovelli Scenes","info":"","category":"","in":[{"x":80,"y":220,"wires":[{"id":"cdc24e36.f86f6"},{"id":"1a12e4e.517f91b"}]}],"out":[{"x":660,"y":40,"wires":[{"id":"8fe92f2d.f0c5","port":0}]},{"x":660,"y":80,"wires":[{"id":"8fe92f2d.f0c5","port":1}]},{"x":660,"y":120,"wires":[{"id":"8fe92f2d.f0c5","port":2}]},{"x":660,"y":160,"wires":[{"id":"8fe92f2d.f0c5","port":3}]},{"x":660,"y":200,"wires":[{"id":"8fe92f2d.f0c5","port":4}]},{"x":660,"y":240,"wires":[{"id":"8fe92f2d.f0c5","port":5}]},{"x":660,"y":280,"wires":[{"id":"8fe92f2d.f0c5","port":6}]},{"x":660,"y":340,"wires":[{"id":"e7b5614b.548d6","port":0}]},{"x":660,"y":380,"wires":[{"id":"e7b5614b.548d6","port":1}]},{"x":660,"y":420,"wires":[{"id":"e7b5614b.548d6","port":2}]},{"x":660,"y":460,"wires":[{"id":"e7b5614b.548d6","port":3}]},{"x":660,"y":500,"wires":[{"id":"e7b5614b.548d6","port":4}]},{"x":660,"y":540,"wires":[{"id":"e7b5614b.548d6","port":5}]},{"x":660,"y":580,"wires":[{"id":"e7b5614b.548d6","port":6}]},{"x":660,"y":640,"wires":[{"id":"57b63c80.7cd5d4","port":0}]}],"env":[],"color":"#DDAA99","outputLabels":["Single tap up","Double tap up","Triple tap up","Quad tap up","Quint tap up","Hold up","Release up","Single tap down","Double tap down","Triple tap down","Quad tap down","Quint tap down","Hold down","Release down","Config tap"],"status":{"x":260,"y":540,"wires":[{"id":"8888a659.640a08","port":0}]}},{"id":"cdc24e36.f86f6","type":"switch","z":"76cacb8d.f71ab4","name":"Scene ID","property":"payload.event.scene_id","propertyType":"msg","rules":[{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"3","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":260,"y":220,"wires":[["8fe92f2d.f0c5"],["e7b5614b.548d6"],["57b63c80.7cd5d4"]]},{"id":"8fe92f2d.f0c5","type":"switch","z":"76cacb8d.f71ab4","name":"Up Actions","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"7680","vt":"str"},{"t":"eq","v":"7860","vt":"str"},{"t":"eq","v":"7920","vt":"str"},{"t":"eq","v":"7980","vt":"str"},{"t":"eq","v":"8040","vt":"str"},{"t":"eq","v":"7800","vt":"str"},{"t":"eq","v":"7740","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":490,"y":160,"wires":[[],[],[],[],[],[],[]],"outputLabels":["Single Tap Up","Double Tap Up","Triple Tap Up","Quad Tap Up","Quint Tap Up","Hold Up","Release Up"]},{"id":"e7b5614b.548d6","type":"switch","z":"76cacb8d.f71ab4","name":"Down Actions","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"7680","vt":"str"},{"t":"eq","v":"7860","vt":"str"},{"t":"eq","v":"7920","vt":"str"},{"t":"eq","v":"7980","vt":"str"},{"t":"eq","v":"8040","vt":"str"},{"t":"eq","v":"7800","vt":"str"},{"t":"eq","v":"7740","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":480,"y":460,"wires":[[],[],[],[],[],[],[]],"outputLabels":["Single Tap Down","Double Tap Down","Triple Tap Down","Quad Tap Down","Quint Tap Down","Hold Down","Release Down"]},{"id":"57b63c80.7cd5d4","type":"switch","z":"76cacb8d.f71ab4","name":"Config Action","property":"payload.event.scene_data","propertyType":"msg","rules":[{"t":"eq","v":"7680","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":480,"y":640,"wires":[[]],"outputLabels":["Config Tap"]},{"id":"1a12e4e.517f91b","type":"function","z":"76cacb8d.f71ab4","name":"Status Reporter","func":"var scene_id = msg.payload.event.scene_id\nvar scene_data = msg.payload.event.scene_data\nswitch(scene_data){\n    case 7680:\n        if(scene_id == 2){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 1 UP\"});\n        } else if(scene_id == 1){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 1 DOWN\"});\n        } else if(scene_id == 3){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: Config\"});\n        }\n        break;\n    case 7860:\n        if(scene_id == 2){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 2 UP\"});\n        } else if(scene_id == 1){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 2 DOWN\"});\n        }\n        break;\n    case 7920:\n        if(scene_id == 2){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 3 UP\"});\n        } else if(scene_id == 1){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 3 DOWN\"});\n        }\n        break;\n    case 7980:\n        if(scene_id == 2){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 4 UP\"});\n        } else if(scene_id == 1){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 4 DOWN\"});\n        }\n        break;\n    case 8040:\n        if(scene_id == 2){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 5 UP\"});\n        } else if(scene_id == 1){\n            node.status({fill:\"blue\",shape:\"dot\",text:\"Tap: 5 DOWN\"});\n        }\n        break;\n}","outputs":0,"noerr":0,"initialize":"","finalize":"","x":260,"y":340,"wires":[]},{"id":"8888a659.640a08","type":"status","z":"76cacb8d.f71ab4","name":"","scope":["1a12e4e.517f91b"],"x":140,"y":540,"wires":[[]]}]
2 Likes

Damn, wish I came here first! Just came by to provide the same updated subflow for OZW. Here is mine, I changed the order of outputs to Up would be on top, otherwise looks pretty much the same.

[{"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"]}]
1 Like