Motion audio clip announcer

This plays an audio clip whenever a sensor detects motion.

blueprint:
  name: Motion audio clip announcer
  domain: automation
  input:
    motion_entity:
      name: Motion Sensor
      description: Entity that causes announcement
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
    speaker_target:
      name: Speaker
      description: Entity to announce motion on
      selector:
        target:
          entity:
            domain: media_player
    audio_clip_url:
      name: Audio clip URL
      description: URL of the audio clip to play
    cooldown:
      name: Announcement cooldown
      description: The minimum time needed in between announcements
      default: 30
      selector:
        number:
          min: 0
          max: 600
          unit_of_measurement: seconds

mode: single

trigger:
  platform: state
  entity_id: !input motion_entity
  from: "off"
  to: "on"

action:
  - service: media_player.play_media
    target: !input speaker_target
    data:
      media_content_type: music
      media_content_id: !input audio_clip_url
  - wait_for_trigger:
      platform: state
      entity_id: !input motion_entity
      from: "on"
      to: "off"
  - delay: !input cooldown