Play audio loop on Sonos (for use with Alarmo)

I have installed Alarmo.
When the alam is triggered some lights come on and a script is called which plays an audio wav file (in a loop) out of the Sonos speakers.
Everything works as expected except the audio wav file only plays once.
The audio should play in a loop until the alarm is disarmed.
The code for the script is below - any ideas please?

alias: Play alarm trigger message
sequence:
  - service: media_player.volume_set
    data:
      volume_level: 0.18
    target:
      entity_id: media_player.living_room
  - repeat:
      until:
        - condition: state
          entity_id: alarm_control_panel.alarmo
          state: disarmed
      sequence:
        - service: media_player.play_media
          target:
            entity_id: media_player.living_room
          data:
            media_content_id: media-source://media_source/local/IntruderDetected.wav
            media_content_type: audio/x-wav
          metadata:
            title: IntruderDetected.wav
            thumbnail: null
            media_class: music
            children_media_class: null
            navigateIds:
              - {}
              - media_content_type: app
                media_content_id: media-source://media_source
        - wait_template: "{{ is_state(\"media_player.living_room\", \"idle\") }} "
          continue_on_timeout: true
icon: mdi:alarm-light
mode: queued
1 Like

I would like to know how to do this also. Hopefully someone can help us.

1 Like