e.g. If I setup an automation to turn my lights on, with a condition that it’s after Sunset, does that mean they could be turned on at a time that is up to Midnight of that day or Sunrise of the next?
Someone correct me if I’m wrong, but I believe the threshold is midnight.
Click on your Sun icon. Notice it tells you when it’s about to set. When it sets is when the condition is triggered. Only happens once. Same for when it’s about to rise. If you want you can also the the elevation to trigger events.
alias: 'Dusk Automations'
trigger:
platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: -7.0
Ah, so it really means at Sunset or Sunrise. (with offsets if required)
Thanks, that makes sense!
On further thought, this seems logical as a trigger but not a condition. Elevation does seem logical as a condition.
Actually I misread your question so my answer isn’t right. I was responding as if it were a trigger you were asking about. I would have thought what ih8gates said then. I use Sun above or below horizon as a condition which is a little clearer and without knowing your automation will probably achieve the same thing for you.
Like :
- condition: state
entity_id: device_tracker.peters_iphone
state: 'home'
- condition: state
entity_id: sun.sun
state: 'below_horizon'
Agreed.
Now I’m looking at the time condition and it too seems ambiguous to me
You can test for after a particular time without including a before time?
Midday/Midnight must be the threshold as ih8gates suggests
Time’s not ambiguous. But it is treated differently for triggers and conditions.