Hi.
I have an automation in Node Red involving motion sensor and a light switch, where the motion sensor does not kick in if the light is turned on via the light switch.
I’m doing this by creating an input_boolean helper that is set to on if the light is turned ON via the light switch.
If the helper is set to ON, the motion sensor does not kick in.
This works fine… until I turn on the light via the Lovelace UI on my phone or in my web browser. Doing this does NOT change the state of my input_boolean helper.
But there must be a way to do this?
Maybe a service call?
if light turned on via Lovelace, then set input helper to ON?
First let’s make sure we’re understanding what you want:
It sounds like you want the motion sensor not to kick in no matter how the light is turned on.
If that’s the case, you can just use the status of the light. You don’t need the helper at all.
In Node-RED, attach a current state node (Server is “Home_Assistant”. Entity ID is “light.hall_light” (whatever your light is). If State is “is” and “on”) to your trigger for the motion sensor and the bottom output (so the light is “off”) to the rest of your flow.
Thanks for answering, and sorry for the late reply.
So I’ve probably done some overthinking here.
But I’ve always imagined that this will create at catch-22 situation, since the sensor will also change the light state to on.
How will the light know when to be turned off again if turned on by the sensor?
There must be something we haven’t thought of here, this is too easy
The light doesn’t “know” how it’s been turned on. As far as it’s state is concerned, using the switch, an automation, or a ui toggle all have the same effect. (The light turns “on” and it reports “on” as it’s status.
So, unless you need to know how it came to that state, just use a “light has been on for ?? minutes” condition to turn it back off again after a certain time (and if the motion sensor is not reporting motion).