I came from Insteon world and an ISY994i so I’m still trying to figure out the equivalent in HA. In the past, I would use state variables and integer variables where’d I’d need them. 0 = off, 1=on light swtich, 2=motion on, etc. In HA, everyone mentions input boolean (toggle?) as a solution.
After trying a couple of automations… my input boolean directly follows the light switch. So physical pressing the light switch throws the input boolean and also when the motion sensor turns on the light switch…disabling the automation and never turning off. And thats why I’m posting it here. So I thought to disable the motion automation instead.
Hardware:
Lutron Caseta Light Switch (Relay, non dimming)
Aqara Motion Sensor P1
Aqara M2 Hub
I believe its an Homekit Integration inside HA.
Here’s how I want it to work:
Light Switch On - Disable Motion
Light Switch Off - Enable Motion
You can simplify this massively by just having an automation that triggers on your motion sensor but with a condition that the light is off. That way, the automation will only run if motion is detected and the light is off.
You also dont need any input boolean either just condition of the light device being off.
EDIT: i would also rexommend using the automation UI for this as it is a fairly simple automation.
I don’t want that to happen. If the wife turns on the light, I want it to stay on until she turns it off. Manual On & Manual Off.
Now is where I could do an Input Boolean - Toggle. Correct?
Light Switch On - & Motion clear - then toggle Input Boolean On … in a separate automation?
then a (3rd) condition (Input Boolean = On)
Then the question is…how & where do I toggle (off) the Input Boolean.
Maybe a Light Switch Off - Motion Clear (45 seconds) then toggle Input Boolean off
The light swtich would have to be pressed before walking into the closet and setting off the motion detector.
Again, i dont think you need an input boolean. Try creating a 3rd trigger that is light turned on with a trigger id of light_manual.
In your actions have if triggered by light_manual, turn on light, then wait for light to turn off. As the mode is set to single, it will not trigger again until the first run has finished. As such, when the light turned on waiting for turn off, it will not run on presence until a manual turn on is turned off. I would set delay to maybe 30 secs on the loop. Like this…
Actually thinking about this more, it should probably have 1 trigger for turning on light manually and 1 trigger for presence. Then depending how the process started (manual or auto) wait for the off state to happen, either light turned off again or no presence. This will ensure automation will not trigger again until the end action is completed based on start action. Like this…
Wow. Thank You! It works perfect. I came up with a solution like your post 2nd to the last. It worked, but with two automations and a helper. Now down to one automation and no helper! Super grateful!
One question. So with these Aqara motion sensors, after the default 30 timeout setting in each P1 motion sensor, they actually turn off the light briefly and then the light comes back on even when constant motion is happening. 30 seconds is acceptable and no need to alter that. My thinking is to add a delay/wait/timeout into your automation recipe. I tried it at the “Wait for Master Bedroom Closet Motion stopped detecting motion”. From 00, tried 05 & 35 seconds. No luck. “Continue On Timeout” seems important to have on. I added a “Wait” for 5 seconds before the very last Call A Service Light Turn Off. Then the light stayed off for an amount of time.
Just thinking. If on the Light Switch shutting Off after the motion clears… would be excellent to wait or delay the automation from a couple of seconds, then it would say exit the IF THEN loop.
Or wait for motion = clear for 5/10/15 seconds and then shut the light off.
Motion Detected / Motion Clear / Motion Detected every 30 or so seconds. Light goes fully off and then back on almost immediately.
I think I figured it out. Still more testing needed. I went the variables approach. Call Service Input Number Set. 0 is off (motion & manual) & 1 is on manual & 2 is motion on.
One thing I would like, if its on motion and I pressed the light switch, would be awesome if it switched to “1” manual on.