The following seems to work until we hit Midnight, at which point the light turns on.
The logic intended: Turn on the light when I get home, but only if it’s between sunset and 10PM. All other times, do nothing.
When midnight hits, the condition “before 10PM” becomes true and the sunset condition is already true.
condition:
condition: and
conditions:
- condition: sun
after: sunset
before_offset: "-1:00:00"
- condition: time
before: '22:00:00'
- condition: state
entity_id: device_tracker.melanies_iphone_red
state: 'home'
action:
- service: switch.turn_on
entity_id: switch.entertainment_center
So, I can’t figure out how to get the action to fire between midnight and sunrise.
Would I create an AND condition to first handle 12:01AM through Sunrise, and then another AND condition for Sunset - 10PM separated by an OR condition?
“If it’s before sunrise and the phone is home, do this, OR if it’s after sunset and prior to 10PM, do that.”