Node-Red - Multiply conditions on switch node? (HASS EVENTS)

Hi,

I’m using Home Assistant with Z-wave and Deconz.
My currently setup is using three switch-nodes to analyse the Home Assistant Events,

  1. switch checks for event_type:
  2. switch check for id/entity
  3. switch check for scene_id/deconz event

But I keep thinking that it can be done in a smoother way?

How are you handeling this?

I can’t access my server at the moment but I think there is a ‘filter’ node available that allows multiple conditions to be used.

For deconz I use the web socket node to receive updates. I don’t have zwave remotes so I’m handling all zwave (plugs, roller shutters) with the service node.

FYI the hue taps are being used as normal remotes with four buttons and giving all the intelligence with node red

Would it be possible for you to share a flow using websocket node?

I acutally saw a video with the Hue tabs yesterday, and wanted to buy one, and try to use it.
I live in denmark, with Danish outlets and wallswitches, but is thinking to 3d-print some solution :slight_smile: I looks very interesting.

The “filter” node from home-assistant-node is only possible during state changes, and deconz has no state change, but only events.

You could simplify with a function node.

I have used two solutions to avoid an overabundance of switch nodes. The first is collapsing everything into a single function node. While this works, in some ways it makes things more complex and harder to understand. I’ve also had success in feeding everything into an MQTT-out node. So in your case, you could turn the three events into a message like ‘event_type/id/scene_id’. Then you can have multiple MQTT-in nodes looking for all the combinations you need (with +/* wildcards if needed). This works well in scenarios where the switches have lots of conditions. It also makes it easy to change you mind later, or add extra MQTT-in nodes to do things like logging.

Sure.
Here you have.

[[{"id":"e710273c.dc9f68","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"595e970a.b66ad8","type":"websocket in","z":"e710273c.dc9f68","name":"deCONZ","server":"28cf848.cc20f7c","client":"","x":180,"y":600,"wires":[["15c7c3ea.961f24"]]},{"id":"15c7c3ea.961f24","type":"switch","z":"e710273c.dc9f68","name":"TAP 15: Salon","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"e\":\"changed\",\"id\":\"15\",\"r\":\"sensors\",\"state\"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":380,"y":600,"wires":[["2ee6d321.5962e4"]]},{"id":"2ee6d321.5962e4","type":"switch","z":"e710273c.dc9f68","name":"Boton","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"buttonevent\":34","vt":"str"},{"t":"cont","v":"\"buttonevent\":16","vt":"str"},{"t":"cont","v":"\"buttonevent\":17","vt":"str"},{"t":"cont","v":"\"buttonevent\":18","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":570,"y":600,"wires":[[],[],[],["453d575.478b228"]]},{"id":"453d575.478b228","type":"api-call-service","z":"e710273c.dc9f68","name":"TG Balcon","server":"cd7217a1.a326d","service_domain":"light","service":"toggle","data":"{ \"entity_id\": \"light.balcon\" }","mergecontext":"","x":750,"y":620,"wires":[[]]},{"id":"28cf848.cc20f7c","type":"websocket-listener","z":"","path":"ws://192.168.0.yyy:443","wholemsg":"false"},{"id":"cd7217a1.a326d","type":"server","z":"","name":"Home Assistant","url":"http://192.168.0.xxx:8123","pass":"xxx"}]

I have removed addresses and passwords but you should be able to paste into node-red and take a look.

I hope it helps you.