How to automate countdown timer with Alexa TTS

Hi All,

Very new to the HA world but learning as I go on.

I have a konnected board for my home alarm and one of the automations I’ve put in place is for my Amazon Echo Dot/Alexa to say some things based on whether the alarm has been triggered or not.

For example, when I instantly arm the system (like if I’m going to bed), Alexa says “Perimeter defenses online” (cheesy, I know, the wife rolled her eyes big time).
Here is the automation for that:

- alias: Alexa Armed Home
  trigger:
    - platform: state
      entity_id: alarm_control_panel.alarm
      to: armed_home 
  action:
    - service: media_player.alexa_tts
      data:
        entity_id: media_player.my_echo_dot
        message: "Perimeter defenses, online"

If I’m stepping out of the house, and I trigger the alarm, a different automation kicks in that says, “Perimeter defenses online in T-minus 60 seconds” After 60 seconds, the trigger state goes from ‘pending’ to ‘armed_home’ and Alexa says “Perimeter defenses online”

Here is the automation for that

- alias: Alexa Armed Away
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.alarm
      to: pending
  action:
    - service: media_player.alexa_tts
      data:
        entity_id: media_player.my_echo_dot
        message: "Perimeter defenses online, in T minus 60 seconds"

For the automation above (the t-minus 60 seconds one), is there a way for me to have Alexa count down by every 5 seconds after the alarm has been set?

So it would basically be something like:
“Perimeter defenses online in T minus 60 seconds”
“55”
“50”
“45”
then after the countdown goes to 0, it triggers the first automation I posted (“Perimeter defenses online”).

Appreciate the help and thank you in advance!

This is what I came up with. Basically an automation triggers a “countdown” script, which is a sequence of media_player.notifiy_alexa_media and some delays:

Automation:

- alias: 'Alarm: Exit Delay Countdown'
  trigger:
    platform: state
    entity_id: alarm_control_panel.ha_alarm
    from: disarmed
    to: arming
  action:
  - service: script.turn_on
    entity_id: script.alexa_alarm_countdown

Script:

alexa_alarm_countdown:
  sequence:
    - service: notify.alexa_media
      data:
        target:
        - media_player.office_dot
        data:
          type: announce
        message: "System Armed.  You now have T minus 30 seconds to vacate the premises."
    - delay: 00:00:05
    - service: notify.alexa_media
      data:
        target:
        - media_player.office_dot
        data:
          type: announce
        message: "25"
    - delay: 00:00:05
    - service: notify.alexa_media
      data:
        target:
        - media_player.office_dot
        data:
          type: announce
        message: "20"
    - delay: 00:00:05
    - service: notify.alexa_media
      data:
        target:
        - media_player.office_dot
        data:
          type: announce
        message: "15"
    - delay: 00:00:05
    - service: notify.alexa_media
      data:
        target:
        - media_player.office_dot
        data:
          type: announce
        message: "10"
    - delay: 00:00:05
    - service: notify.alexa_media
      data:
        target:
        - media_player.office_dot
        data:
          type: announce
        message: "5"

Hope this helps, or maybe someone has a better way?