The problem is that inside the garage if I stand still for few seconds then the automation moves from step-3 to step-4 and turns off the lights after 2 minutes even if Iâm inside the garage and moving.
Is there a way to create a âwhile loopâ for steps 3 & 4 or to send automation back to step-3 if movement is detected during time window of step-4?
I think it would be more simple to just use two automations - one for on and one for off - than to try to do it all in one and jump thru hoops (or loops ) to get it to work.
I think your wait template needs to âandâ all the individual motion sensor tests instead of "or"ing them. I.e.:
- wait_template: >-
{{ is_state('sensor.garage01_occupancy_status', 'Clearance') and
is_state('binary_sensor.garage_motion_hue_motion', 'off') and
is_state('binary_sensor.amcrest_01_motion_alarm', 'off') and
is_state('binary_sensor.amcrest_02_motion_alarm_motion_alarm', 'off')}}
This will work, however, only if at least one of the sensors has detected motion immediately after the automation triggers. If not, then add a wait at the beginning until at least one is sensing motion. It will probably need a time out and a check afterwards that it completed (i.e., saw at least one sensor detecting motion.)
I went inside the garage and everything worked, I barely stopped pacing for two seconds and guess the wait_template tested âtrueâ and lights went off after the specified time delay.
Iâve created an input boolean that acts like a kill switch to easily enable or disable automation functionality. For example, if I am doing some work in garage that will take over an hour then I would not want the lights to turn off as per this automation.
So in the above case, Iâd toggle the switch to off and the automation will not operate garage lights. But in this case Iâll have to operate lights manually.
This is how my UI looks like:
So all the family members can enable/disable the functionality of this automation without needing admin privileges.
Very interesting! Thanks for the explanation.
I use an Aqara presence sensor in the garage for the same reason because Iâm too lazy to toggle the automation. :O)
Why do you have a 1 second delay before turning the lights on?
Thanks again for the help. My garage light automation is now working flawlessly! I have been battling this forever.
I wasnât having any luck with the wait template so I used an if/then instead.
My automation includes a presence sensor which helps when I am working in a stationary position but my âkill switchâ is the shop lights. If they are on that means I turned them on manually and that keeps the other lights on.
alias: Lights Shop NEW
description: ââ
trigger:
alias: When ANY shop group sensor changes to ON
platform: state
entity_id: