I created an automation to automatically turn the garage lights on, when motion is detected and then turn them off 5 minutes after motion has stopped. I don’t want to turn them off, if they were manually turned on, which is what the input boolean is tracking.
The light automatically turns on properly, but it will not turn off (most of the time). What am I missing or done wrong?
Thanks in advance!
alias: Motion - Garage Lights
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.ratgdo32_2b11a0_motion
to:
- "on"
from:
- "off"
id: "On"
- trigger: state
entity_id:
- binary_sensor.ratgdo32_2b11a0_motion
for:
hours: 0
minutes: 5
seconds: 0
from:
- "on"
to:
- "off"
id: "Off"
conditions:
- condition: state
entity_id: input_boolean.state_toggle_garage_light
state:
- "off"
actions:
- if:
- condition: trigger
id:
- "On"
then:
- type: turn_on
device_id: e3758227c807d6a60c35097079b2d537
entity_id: 200ee03e6b3d6b13cc9cc3186cf70988
domain: switch
else:
- type: turn_off
device_id: e3758227c807d6a60c35097079b2d537
entity_id: 200ee03e6b3d6b13cc9cc3186cf70988
domain: switch
- action: input_boolean.turn_off
metadata: {}
target:
entity_id: input_boolean.state_toggle_garage_light
data: {}
mode: single
alias: State Toggle - Garage Light
description: ""
triggers:
- type: turned_on
device_id: e3758227c807d6a60c35097079b2d537
entity_id: 200ee03e6b3d6b13cc9cc3186cf70988
domain: switch
trigger: device
id: "On"
- type: turned_off
device_id: e3758227c807d6a60c35097079b2d537
entity_id: 200ee03e6b3d6b13cc9cc3186cf70988
domain: switch
trigger: device
id: "Off"
conditions: []
actions:
- if:
- condition: trigger
id:
- "On"
then:
- action: input_boolean.turn_on
metadata: {}
target:
entity_id: input_boolean.state_toggle_garage_light
data: {}
else:
- action: input_boolean.turn_off
metadata: {}
target:
entity_id: input_boolean.state_toggle_garage_light
data: {}
mode: single