I have a script that turns on the hallway light and outside front door light when my wife arrives home after a certain time. It triggered last night accidentally (gps hiccup I think) but I’d like to add a timer to it so it goes off after 10 minutes. What do I need to add to this please?
alias: Hallway on when Helen arrives home
hide_entity: False
trigger:
- platform: state
entity_id: device_tracker.helen
from: 'not_home'
to: 'home'
condition:
- condition: numeric_state
entity_id: sensor.solar_angle
below: -8.0
action:
- service: light.turn_on
entity_id: light.hallway
data:
brightness: 180
- service: switch.turn_on
entity_id: switch.front_door_switch_15_0
yeah thanks, I do that already for motion in kitchen/bathroom etc but was wanting to know if there is a way of doing it in 1 automation using a device tracker state?
is there a way I could call a script that would check a condition, say Time before 10pm, so do not turn off the outside light (as it auto comes on after sunset and off at 10pm) but turn off the hallway light?
I don’t want my wife to come home at 9pm and it then turns off the outside light before 10pm
I am getting myself all confused as to the best way to do it? any thoughts please?
I’d instead use the approach Coolie1101 is suggesting. Turn it on automatically and then work out the conditions that would result in it being turned off. For example, if you’re using OwnTracks or another tracker that will give you either time or distance to home, then you could do something like:
Turn off at 10:00 if everybody is home
Turn off at 10:00 if you aren’t home, and you’re more than 20 minutes from home
Turn off at 10:00 if your wife isn’t home, and she’s more than 20 minutes from home
After 10:00, turn on when whoever is away is within 10 minutes of home
After 10:00, turn off 5 minutes after somebody comes home
Each of those would be a separate automation, though with care you might be able to merge the second and third, and maybe all the first three.
you got me thinking, it would be easier if I kept the turn on automatically at sunset and off again at 22:00 then had a condition where if the light is OFF and Solar angle is say -8 as it is 100% after 22:00 and light is already off, then using a distance trigger via phones/gpslogger to turn on etc etc
will post code once I work it out
but thanks, gave me something to think about, as I was stuck