Anamico / node-red-contrib-alarm

Nodes to build your own home alarm system. Designed to work easily with (but does not require) homekit.
MIT License
24 stars 8 forks source link

Select a subset of State Changed outputs #30

Open macinspak opened 2 years ago

macinspak commented 2 years ago

Sometimes we may want to trigger a flow only if the panel enters a certain state. Such as turning off sirens and alarms if the panel is disarmed.

Screen Shot 2021-08-18 at 9 51 51 am

Perhaps we can add a field at the bottom of the config for "State Changed" to allow the user to select a subset of modes that will send an output?

So by default, none are selected. But if at least one is selected, it will only output when the panel transitions to those selected subset of modes.

That will remove the need to use a switch node as well to filter out modes that are not required.

macinspak commented 2 years ago

Could even make it smarter and have the payloads configurable for each mode. In the screenshot example, the "Alarm Off" node is setting the payload to { "On": false } in order to send that payload to the siren. If we could configure that payload against the "off" state in the State Changed node, then it would only send that exact payload whenever the state changed to "Off", removing the need to both filter and adjust the msg.

Maybe a single payload override field. If there are different payloads for different states you can just create a couple of State Changed nodes, one for each different payload required, and configure them to fire on the relevant state transitions.