[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

1 Like

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"]}]
3 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.