I read your automation as it will trigger at sunset. The the condition will be met only if both device trackers are not home. I think Or would work better for the OPs request. Or would return true if on or both are not home.
Conditions won’t keep anything on. Conditions are only checked once when the trigger is met. In this case, sunset is a singular event so the trigger only happens once and if both devices left after sunset the light wouldn’t turn on.
@Moe247365 if you want to have a light on anytime someone comes home after sunset I would create three triggers. One for sunset so the light always triggers at sunset. Then one for each of the devices leaving home so it will turn on the light when either person leaves home.
Everyone thank you! this is what I ultimately ended up doing.
alias: Turn On Outside Lights On When Moe Is Not Home
hide_entity: true
trigger:
- platform: state
entity_id: device_tracker.moes_cell
from: ‘home’
to: ‘not_home’
- platform: sun
event: sunset
condition:
condition: and
conditions:
- condition: sun
after: sunset
- condition: state
entity_id: ‘device_tracker.moes_cell’
state: ‘not_home’
action:
- service: light.turn_on
entity_id: light.outside_lights
alias: Turn On Outside Lights On When Donna Is Not Home
hide_entity: true
trigger:
- platform: state
entity_id: device_tracker.donnas_s7
from: ‘home’
to: ‘not_home’
- platform: sun
event: sunset
condition:
condition: and
conditions:
- condition: sun
after: sunset
- condition: state
entity_id: ‘device_tracker.donnas_s7’
state: ‘not_home’
action:
- service: light.turn_on
entity_id: light.outside_lights