Please explain how to implement Input Booleans with Node Red

Hey Everybody, thanks to this awesome community, I have my first two automations going. However, in an effort to become more acquainted with Node Red, I am wanting to learn how to add an Input Boolean to my existing automation, so that I can have manual control of it via the front end. If I understand it correctly, I need to use the trigger: state node, but I am 90% I am doing it wrong, as I cannot figure it out. I also tried using the current state node, but again, no luck. This is my flow

and this is my input boolean
I assume I have to put the new input boolean node in between the current state node and the switch node.

Not 100% what you are asking for but if you want to control anything with your input_boolean you will need to use the event state node set to your boolean. When you flick the switch it can call what ever service you want using the call service node.
If you want your automation to work depending on whether the input_boolean is on or off would mean you using a current state node set to your boolean and placing it into your flow.

1 Like

Quick check, are you using the ‘node-red-contrib-home-assistant-websocket’ palette?

As above it’s the event:state node that you need.

Correct, or after chromecast named node. You don’t want to continue if the boolean is off, so select in “halt if state” select is and put “off”

You can also use the trigger state node where you can add several constraints in one node

I use Input booleans to turn enable and disable my device trackers manually from the HA UI all the time.



   name: Enable Notifications
   initial: on
   icon: mdi:cellphone-iphone
1 Like

Thank you for posting the picture! It’s so easy and obvious now that you post it but I’ve been searching for this exact thing and painfully reading all the misunderstandings. This was it!

Note the state and entity locations set to “None”. That’s important to not change the original messages to true/false.

Also note the “string” check for “on” or “off” not a boolean. I got confused when debugging and manually triggering the check because it can coerce it to a true/false boolean on output, but once you keep the original output, it won’t trigger as you expect.

I’m extremely confused by the current state node. It seems like even when my input boolean is “on”, the current state node reports “off”.

Here’s the “Alarm Disarmed?” current state node:

The second path is never executed, even when the input boolean is “on”. Can anyone see what I’m doing wrong?

Do you have two input_booleans dealing with your alarm? One for armed and one for disarmed? If so, can I ask why? I think you could get away with a simple “Alarm” boolean, and when it is on, the alarm is armed and when it is off, the alarm is disarmed.

For that first Current State node, have you tried toggling the input_boolean and seeing if Node-red picks up the change? I had the issue a while ago that my input_booleans wouldn’t pick up changes. I do not know what caused it but it hasn’t happened for a while now.

Your automation looks correct though. Try restarting Node-Red and see if that fixes the problem.

No, I only have one input boolean called “alarm_armed”, so if that’s on then the alarm is armed, and if it’s off then the alarm is disarmed.

I use the current state node with that same input boolean in other Node Red sequences and it seems to work as intended, but not in this sequence.

Thanks for the advice. I’ll try restarting Node Red and report back here