I’m pretty new to HA and have a few basic automations for iOS alerts but I’m having trouble finding out what I would need to do to make this happen… I want my flood lights to turn on when I arrive home but instead of a set time with a delay I was hoping I could have them turn off when my side door closes … but ideally only when the were turned on by the arrival automation.
- action:
- service: light.turn_on
data:
entity_id: light.flood_lights
brightness: 125
- delay: ‘00:02:30’
- service: turn.light_off
entity_id: light.flood_lights
alias: Flood Lights Arrival
condition:
- after: sunset
condition: sun
id: '1506878858096'
trigger:
- entity_id: device_tracker.iphone
from: not__home
platform: state
to: home
As I have no idea the name of your door sensor, I have just called it sensor.side_door. You can change the name as you need.
# FLOOD LIGHTS OFF #
alias: Flood Lights Off
trigger:
platform: state
entity_id: sensor.side_door
from: 'open' # note that this may be 'on' depnding on your sensor config #
to: 'closed' # note that this may be 'off' depnding on your sensor config #
action:
service: light.turn_off
entity_id: light.flood_lights
That was for a fan, but the same principle applies. When you turn on the light through the automation, also turn on the input_boolean. Then when the light is turned off (for any reason) you turn off the input_boolean. The closing of the door however has a condition that only turns the light off if the input_boolean is on.
Thank you I didn’t really understand when I would use an input boolean but making use of it to do this gave me a few ideas… this seems to have worked But I tried to set a delay so the input Boolean turns off in the automation but that doesn’t seem to be working… I need to stop using the automation editor because that just seems to make a mess and i end up fixing it manually anyway.
Nevermind It works without the delay and i can just turn it off with another action. Thanks again… my messed up formatting didnt help either, removed it all and started over.