When using sun elevation as a trigger I can use both above: -4.0 and below: -4.0
Can somebody please explain what the difference between above and below is? above: -4.0 seems unlogically since the phrase above is the opposite of a negative altitude, which is indicated by -4.0.
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: '-4.0' # Can be a positive or negative number
How can I be sure the trigger fires only when the sun sets and not also when it rises?
I do not want to use the sunset event or offset as elevation makes me control the trigger time most accurately.
The definition of say dawn is when the sun rises above - 6 degrees
Hence above a negative number
To trigger at sunset, use the sunset trigger, sunrise trigger has a sunrise trigger.
Read the sun.sun component
above and below mean when the value goes above or below what you define. So if you say above: -4 it’ll trigger when it goes above -4 (for instance, from -4 to -3). Opposite for below.
HA Triggers on transitions so if elevation is at 10 degrees and your trigger is 5 degrees above then it will trigger at 5 degrees above ie when it’s falling too.
You will need to condition the automation with falling or rising if you need only one
Was thinking about if above would be used when the sun is rising, and below for descending.
I think I get it. Still the sun will be above whatever elevation, -6, -4 or even 3 the second it gets above the elevation point mentioned. In fact an automation will trigger both on sunset and sunrise at elevation above -4.0.
How can I be sure the trigger will fire at sunset and when the sun is at -4, and not at sunrise?
Good idea.
Around here, at 60 degrees north, the time for sunrise varies by 5:30 hours through the year - from 09:18 in January to 03:53 at midsummer, and sets from 15:22 in January to 22:44 midsummer.
At midsummer (June 21.) we don’t even have Night or Astronomical Twilight. Civil Twilight occurs 3 times a day; 00:00 - 00:27, 02:09 - 03:53 and 22:43 - 00:00.