WTH isn't there an easy way to keep trigger thresholds and condition thresholds in sync

My use case is usually for automating window blinds. The ultimate state of the blind is determined from time of day, temperature, position of the sun, what the tv is doing etc. This type of automation then has a heap of triggers when these events transition. So the TV might transition to OFF, but the state of the blind might be determined by the position of the sun.

2 options presented:
It would be quite convenient to be able to define some substitutions that can be used in triggers, conditions, and actions

Alternatively, it would be good if a trigger could be reinterpreted as a condition. Not the “Triggered by” conditions, but something that could produce a true of false value from one of the triggers. The following shows how similar triggers and conditions look:

This is what the trigger looks like

trigger: numeric_state
entity_id:
  - sun.sun
attribute: elevation
above: 19

and this is currently what a condition looks like

condition: numeric_state
entity_id: sun.sun
attribute: elevation
above: 19

I use input helpers for stuff like that. Here’s the trigger and the condition:

triggers:
  - entity_id: sensor.guest_environment_temperature
    above: input_number.blind_tilt_threshold
    for:
      hours: 0
      minutes: 0
      seconds: '{{ states(''input_number.temperature_delay'')|int }}'

conditions:
  - condition: numeric_state
    entity_id: sensor.guest_environment_temperature
    above: input_number.blind_tilt_threshold

The new purpose-specific triggers and conditions also support the use of numeric entities like Kyle showed above with the Numeric State platforms:

triggers:
  - trigger: sun.elevation_crossed_threshold
    options:
      threshold:
        type: above
        value:
          entity: input_number.elevation_threshold

  # Other triggers

conditions:
  - condition: sun.elevation
    options:
      threshold:
        type: above
        value:
          entity: input_number.elevation_threshold

You can also use trigger_variables combined with Template triggers and conditions:

trigger_variables:
  elevation_thresh: 19
triggers:
  - trigger: template
    value_template: "{{ state_attr('sun.sun','elevation') > elevation_thresh }}"

  # Other triggers

conditions:
  - condition: template
    value_template: "{{ state_attr('sun.sun','elevation') > elevation_thresh }}"

The custom integration Spook includes an “All of these happened” trigger that might reduce your need to mirror the triggers as conditions.

I always try to combine all of those multiple inputs into a single binary sensor using the template integration.

It returns a simple true or false for the question. Should the blinds be closed now.

Use it’s state as the trigger for the automation.

Here is one I recently posted which answers the question should the porch light be on.

I’m always trying to pull this kind of logic out of automations and into isolated sources of Truth upon which my house can react