I made an automation to turn on lights in the garden, I want the lights to turn on after that the sun has set, but if the sun sets after 9:30 p.m. I don’t want them to turn on at all. This bit is not a problem, and that part of the automation works fine. But… I also want the lights only to turn on when my wife, myself or we both are home. So in the automation is an or statement to make that work, but it doesn’t. When we are both at home the lights goes on, but when just one of us is home the lights stay out.
The code I use is shown below, can anyone see any error in it that causes the lights to not turn on when only one of us is at home?
- id: turn_on_garden _lights
alias: Turn on garden lights
trigger:
- event: sunset
offset: '+15'
platform: sun
condition:
- condition: and
conditions:
- condition: time
before: '21:30:00'
- condition: or
conditions:
- condition: state
entity_id: device_tracker.mobiel_wife
state: home
- condition: state
entity_id: device_tracking.mobiel_me
state: home