Hello everyone. I am learning about automation. Right now I have a motion sensor that I can use to turn on an electrical outlet. I want the outlet to stay on for 5 minutes and if the motion sensor triggers again after the 5 minutes I want the outlet to turn on again for 5 minutes. Is this possible to do from the visual automation creator?
Yes. Easiest way is with two automations:
trigger:
- platform: state
entity_id: binary_sensor.your_motion_sensor_here
to: 'on'
condition:
- condition: state
entity_id: switch.your_switch_here
state: 'off'
action:
- service: switch.turn_on
target:
entity_id: switch.your_switch_here
trigger:
- platform: state
entity_id: binary_sensor.your_motion_sensor_here
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: switch.your_switch_here
state: 'on'
action:
- service: switch.turn_off
target:
entity_id: switch.your_switch_here
The first automation will turn on your switch when there is movement. The second automation will only turn off your switch when there has been no movement for 5 minutes.