Use sun elevation with Times of the Day Binary Sensor (TOD)

Reading the documentation I saw that you can use the elevation of the sun as a trigger:

  trigger:
    platform: numeric_state
    entity_id: sun.sun
    value_template: "{{ state_attr('sun.sun', 'elevation') }}"
    below: 3.5

Is it possible to do this in a tod sensor as well? I know you can use offsets for sunset and sunrise, but the elevation would be more useful in my case.

Yes as the sun moves 15° per hour. So your offset is:

60 * 3.5 / 15 = 14 minutes.

Are you sure this has the same effect for every time of the year? What would be the point of the elevation-feature then?

The tod binary_sensor platform does not support using sun elevation. However, you can certainly do this in a template binary sensor:

binary_sensor:
  - platform: template
    sensors:
      above_minus_2:
        value_template: "{{ state_attr('sun.sun', 'elevation') > -2 }}"

Or you can use my sun2 custom integration:

binary_sensor:
  - platform: sun2
    monitored_conditions:
      - elevation: -2

:slightly_smiling_face:

Yes. There are only very minor variations due to the earth’s orbit not being circular (see analemma). Also the angle the sun rises and sets stays the same throughout the year but the rise and set locations and zenith change, so local geographic features like mountains might have an effect.

Not having to do calculations?