I have an automation for when there is motion in my office it turns on some LED strips. It works for the most part but then I wanted to prevent it from constantly triggering. Setting the mode to single works correctly that it will only run one time then wait 5 minutes. My issue is this is the lights will not turn on after the first pass and then not again until I restart automation. Best guess is it seems to be stuck on the wait part an never completing from some run where the lights did not turn on based on the condition. Subsequent triggers will give the message that was something like did not run because in single mode.
I have another automation where if there is no motion detected for 5 minutes the lights turn off. That one works. My goal is when I enter the office and it is at night the lights turn on and stay on until there is no motion for 5 minutes. I do not want to be constantly sending turn on commands or using system resources to check on conditions like are these lights already on every time the motion sensor flips for 10 seconds. I would also like to remove or shorten the 10 second on the trigger but again do not want to be constantly using resources.
trigger:
- type: motion
platform: device
device_id: 32165498765416158961
entity_id: binary_sensor.off_motion
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- service: light.turn_on
target:
entity_id:
- light.off_desk_lights
- light.off_strip_shelf
data:
brightness: 255
rgb_color:
- 255
- 0
- 0
- wait_template: '00:05:00'
continue_on_timeout: true
mode: single