zachowj / hass-node-red

Companion Component for node-red-contrib-home-assistant-websocket to help integrate Node-RED with Home Assistant Core
MIT License
465 stars 182 forks source link

Feature request: One node-red switch to multiple in HA (one switch to rule them all) #5

Closed xppx99 closed 4 years ago

xppx99 commented 4 years ago

Hello,

First let me thank zachowj (and any other contributer that may have helped) for this great work. This is really integrating node-red in HA.

This is a feature request that fits my needs, I assume that may benefit other people too, but honestly I don't understand the complexity of this request and its feasibility (cost vs effort), and I understand if you devs decide against this feature.

I use Node-Red with HA for many things. One of the things is to monitor the connectivity/availability of some devices IoT devices that are important in my system. I want to expose to HA a switch that would activate/deactivate multiple switchs so that I could deactivate the entire monitoring, because sometimes it is useful.

Example 1 - monitor important devices: image

Example 2 - monitor air quality in the house image

What I have implemented is the input_bolean to allow this goal, but it would be much easier and cleaner to make that virtual switch available in Node-Red.

Thanks!

zachowj commented 4 years ago

At the moment I don't see a feasible way to accomplished this. The switches are identified in HA by the node id from NR. So each switch in HA is a one to one reference to a node in NR.

You could expose each event node to HA and then make an input boolean in HA that when changed it sets all the event node switches to the same state as itself with a single call service. That's not much different from what you're doing now though.

shbatm commented 4 years ago

@xppx99 Just happened to be browsing and saw this -- I use a group in my Home Assistant config to give me single control of multiple NodeRED "Switches".

xppx99 commented 4 years ago

Hello guys! So actually there is a way to do what I was asking about with the functionality already provided by this integration.

The way is this: Exposing one of the switchs to act as "master switch", then replacing any "events: state" nodes by the improved "trigger: state" nodes, and then add a condition so that the msg are only propagated if the previously creater "master switch" is ON.

This way, everytime I deactivate the "master switch", every other trigger is also blocked, by the condition added. This as been working great!