I now have an automation that will turn on an outside light when someone returns home if it’s after sunset and the light isn’t already on.
Now I would like to turn this light off after 15mins of it being turned on. I do not want to turn the light off if it was manually turned on or was turned on by another automation.
I know I can use the
for:
minutes: 15
to cover the if the lights been on for 15 mins.
I’m just not sure how to trigger this automation to run only after the “Return Home” automation ran successfully.
Would this work? I added a Delay action, and then a Call Service Action at the end of my working automation.
alias: Turn on Outside Lights coming home
description: >-
Turn on the Outside lights after sunset when the lights are off and someone
returns home.
trigger:
- platform: state
entity_id: device_tracker.mobile
to: home
condition:
- condition: sun
after: sunset
- condition: state
entity_id: light.holiday_wled
state: 'off'
action:
- service: light.toggle
target:
entity_id: light.holiday_wled
data:
color_name: white
effect: Solid
transition: 15
brightness_pct: 100
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- service: light.turn_off
target:
entity_id: light.holiday_wled
data:
transition: 30
mode: single