Bring template support to alerts

In the name of simplifying things can templates support be added directly to alerts?

The ability to create alerts with templates without creating sensors would save me many lines of code and needless sensors.

Could you clarify because alerts already supports some fields with template like title, message and done_message… Could you give some examples ?

I am specifically thinking for the entity_ID or “trigger” so to speak.

For example, I have an alert for my chicken door:

  chicken_door:
    name: Chicken Door is open after dark
    message: Chicken Door is open after dark /ack
    done_message: 'Alert Clear: Chicken Door is closed'
    entity_id: binary_sensor.chicken_door_after_dark
    repeat: 
      - 2
      - 10
    can_acknowledge: True
    skip_first: True
    notifiers:
      - telegram_group

where the entity_id is a template sensor created only for this alert purpose.

    chicken_door_after_dark:
      value_template: '{{ (is_state("cover.chicken_door", "open") or is_state("cover.chicken_door", "unknown")) and states.sensor.time.state > states.sensor.chicken_door_last_call_time_dirty.state }}'

Make sure you vote for your own FR.

I’m also looking for this feature, specifically to allow me to set a templated data.when attribute. E.g.:

name: "TEST: Garage is open!"
done_message: clear_notification
entity_id: input_boolean.test_garage_door
state: "on"
repeat: 2
can_acknowledge: false
notifiers:
  - mobile_app_florinpho
data:
  persistent: true
  tag: garage_door
  chronometer: true
  when: "{{ as_timestamp(states.input_boolean.test_garage_door.last_updated) | round }}"
  sticky: true
  notification_icon: mdi:garage-open
  channel: Status Alerts
  actions:
    - action: garage_close
      title: Close
1 Like