I’d like some lights to turn on 30m before sunset when someone is home or if someone arrives home after 30m before sunset. I have an input_select.home_mode
to represent whether someone is at home.
A single trigger (sunset -30m) with a condition (someone is home) would miss the case that someone comes home and it’s after sunset -30m.
The following seems to work and catch both scenarios. It’s a little inelegant in that each trigger also needs to be expressed as a condition. Is there a nicer way to achieve this?
alias: Evening Lights
description: "Turn on evening lights scene if someone is at home and it's 30m before sunset or later"
trigger:
- platform: state
entity_id:
- input_select.home_mode
from: Away
to: At Home
- platform: sun
event: sunset
offset: "-0:30:00"
condition:
- condition: state
entity_id: input_select.home_mode
state: At Home
- condition: sun
after: sunset
after_offset: "-0:30:00"
action:
- service: scene.turn_on
target:
entity_id: scene.evening_lights
metadata: {}
mode: single