Less verbose config for automation triggers that are also conditions

I have a lot of automations that look similar to this:

- alias: office_occupied_on_normal
  trigger:
    - platform: state
      entity_id: binary_sensor.office_occupied
      to: "on"
      from: "off"
    - platform: state
      entity_id: input_select.house_mode
      to: "normal"
  condition:
    - condition: state
      entity_id: binary_sensor.office_occupied
      state: 'on'
    - condition: state
      entity_id: input_select.house_mode
      state: 'normal'
  action:
    - service: light.turn_on
      data:
        entity_id: light.office_overhead
        brightness: 255

The conditions are the same as the triggers, and the “state” of each condition is the same as the “to” of each trigger.

Using a “template” trigger, ALMOST does the same thing. Like this:

- alias: office_occupied_on_normal
  trigger:
    - platform: template
      value_template: >-
        {{
          is_state('binary_sensor.office_occupied', 'on') and
          is_state('input_select.house_mode', 'normal')
        }}
  action:
    - service: light.turn_on
      data:
        entity_id: light.office_overhead
        brightness: 255

The big difference between these two is that, in the first case (without the template) the “action” executes only when one of the triggers actually happened just now. Where the “template” based trigger will execute the action any time the entities report state, even if the state of that entity is the same as it was before.

To keep the action from firing every time and also having a less verbose config, there are a few solutions.

  1. Have “template” triggers remember the last template evaluation. If the current evaluation returns true but the previous evaluation was also true, don’t execute the actions again.
  2. If some users want the repeated action firing, introduce a new trigger platform (“template_once”, or something) that works the same as template does now, but only fires the action when the evaluation returns true and when the previous evaluation was not true.
  3. Add an optional config to the automation (“triggers_are_conditions: True”, perhaps) that will instruct home assistant to also set up conditions for any triggers that can also be conditions (state, numeric_state, time based triggers, etc. Not event, obviously.).
  4. Make “trigger” optional in an automation and, when not supplied, all conditions also become triggers.
  5. Add a new config element (“trigger_and_condition”, perhaps) that will take a list of triggers that will also be established as conditions.