Can I access Alert duration value?

Hi, I have an alert and I would like to add the total duration the alert has been active (Not idle) to my message. Is there a way I can add that to my message?
Here is my code.

notify:
- platform: group
  name: BrianPhoneAndAlexa
  services:
    - service: alexa_media_brian_s_echo
    - service: mobile_app_brian_s_phone
    
alert:
  garage_door:
    name: Garage door is open.
    entity_id: binary_sensor.garage_door_opened_closed
    state: "on"
    repeat: 15
    can_acknowledge: true
    skip_first: true
    message: The garage door has been open for xxx amount of time.
    data:
      type: tts
    notifiers:
      - BrianPhoneAndAlexa

Thanks

1 Like

I did a search and found this topic.

I put in:

    message: The garage door has been open for {{ relative_time(states.binary_sensor.garage_door_opened_closed.last_changed) }}

Does exactly what I wanted but this may not work for a more complicated alert trigger.

1 Like