Help adding repeat delay

I need help with adding a delay to the TTS broadcast, currently it repeats so fast it doesn’t make a sound. how would I add a delay to the below script.

Thanks

alias: Sliding door open warning
description: ""
trigger:
  - platform: device
    device_id: 5f6531f56b87e01c4032d06c58966363
    domain: cover
    entity_id: cover.cw2gt_v2_2_curtain
    type: closed
condition:
  - condition: state
    entity_id: binary_sensor.openclose_10
    state: "on"
action:
  - service: tts.google_translate_say
    data:
      entity_id: media_player.home_speakers
      message: Sliding door open
  - repeat:
      until:
        - condition: state
          entity_id: binary_sensor.openclose_10
          state: "off"
      sequence:
        - service: tts.google_translate_say
          data:
            entity_id: media_player.home_speakers
            message: Sliding door Closed
mode: single
action:
  - service: tts.google_translate_say
    data:
      entity_id: media_player.home_speakers
      message: Sliding door open
  - repeat:
      until:
        - condition: state
          entity_id: binary_sensor.openclose_10
          state: "off"
      sequence:
        - service: tts.google_translate_say
          data:
            entity_id: media_player.home_speakers
            message: Sliding door Closed
        - delay: 60 # (seconds)
mode: single

As a word of advice, before you use it in more places, entity ids can be changed. So you could change binary_sensor.openclose_10 to something more descriptive like binary_sensor.sliding_door. If you do it now you will have to change it everywhere you have used it.

Also this sort of repeating message automation it is a lot easier using the Alert integration.

1 Like

Thanks Im new to home assistant with no experience with coding or scripting.

I had it configured wrong but the delay is working and should be fine for my purposes, I will have a look at the alert intergration and possibly remake it there.

Thanks again.