I created this automation that turns on the lights when anyone arrives home, then turns them off when we’ve been home after about 10 minutes. this is all based on an input select and an automation that creates a state of “Just Arrived”, then changes to “Home” after a configured time. the issue i can’t wrap my brain around is how to deal when people arrive between those two states. For example, if i arrive, ny sensor goes to “Just Arrived” and the lights come on. 9 minutes later the wife arrives, but since my sensor switches to “Home”, the lights will turn off as she gets home. trying to figure a way to reset that countdown if someone arrives between the times, but i am not sure i can do it in one automation. here is the current one i am using:
alias: LOCATION - Arriving Home Outside Lights
description: ''
trigger:
- platform: state
to: Just Arrived
id: arrival
entity_id:
- input_select.status_sebastian
- input_select.status_ida
- platform: state
entity_id:
- input_select.status_ida
- input_select.status_sebastian
id: home
to: Home
from: Just Arrived
condition:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: '-3'
action:
- choose:
- conditions:
- condition: trigger
id: arrival
- condition: state
entity_id: light.outside_lights
state: 'off'
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.outside_lights
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.automated_outside_lights
- service: notify.haapp_sebs_devices
data:
message: Someone Arriving Home, turning lights on outside
- conditions:
- condition: trigger
id: home
- condition: state
state: 'on'
entity_id: light.outside_lights
- condition: state
entity_id: input_boolean.automated_outside_lights
state: 'on'
sequence:
- service: light.turn_off
data: {}
target:
entity_id:
- light.outside_lights
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.automated_outside_lights
- service: notify.haapp_sebs_devices
data:
message: >-
Turning outside lights off
default: []
mode: single