Playing a chime mp3 via an Echo speaker

I am trying to play a “chime” tone on my Echo speakers when a Unifi G4 doorbell is pressed. Following other threads (mainly aimed at Sonos speakers) I have managed to get the following yaml automation code, but it returns a Message malformed: Unable to determine action @ data[‘actions’][0] error when I try to save it.

The url for the chime is where I have placed the mp3 file using HA’s File Editor ( /www/chime.mp3 ), and if I put that url in to my browser the chime does play.

Any ideas as to where I am going wrong? What I want to happen is for what ever the speaker(s) are playing to (ideally) mute, play the chime, wait 4 seconds, then resume whatever they were playing.

TIA

alias: Doorbell to Echo Speakers
description: ""
triggers:
  - trigger: state
    entity_id: binary_sensor.u00_doorbell_doorbell
    to: "on"
conditions: []
actions:
  - target:
      entity_id:
        - media_player.office_echo
        - media_player.workshop_echo
      data:
        media_content_type: music
        media_content_id: http://192.168.5.56:8123/local/chime.mp3
      action: media_player.play_media
  - delay:
      hours: 0
      minutes: 0
      seconds: 4
      milliseconds: 0
mode: single

Slightly misaligned data and action:

alias: Doorbell to Echo Speakers
description: ""
triggers:
  - trigger: state
    entity_id: binary_sensor.u00_doorbell_doorbell
    to: "on"
conditions: []
actions:
  - target:
      entity_id:
        - media_player.office_echo
        - media_player.workshop_echo
    data:
      media_content_type: music
      media_content_id: http://192.168.5.56:8123/local/chime.mp3
    action: media_player.play_media
  - delay:
      hours: 0
      minutes: 0
      seconds: 4
      milliseconds: 0
mode: single

@Holdestmade, that’s just going to get OP an error message about how “Direct music streaming isn’t supported…”

You can’t treat Amazon’s smart speakers like they are normal media players. They do not allow local streaming, so your file path needs to be through an externally available address. Also, be aware that Amazon has specific formatting and length limits that must be followed.

For both Alexa Media Player and Alexa Devices you need to use the notify component:

#Alexa Media Player
action: notify.alexa_media
target:
  entity_id:
    - media_player.office_echo
    - media_player.workshop_echo
data:
  message: |
    <audio src='https://your.external.address/local/chime.mp3'/>
  data:
    type: tts
#Alexa Devices
action: notify.send_message
target:
  entity_id: 
    - notify.workshop_echo_speak 
    - notify.office_echo_speak
data:
  message: |
    <audio src='https://your.external.address/local/chime.mp3'/>

Another option, available through both AMP and AD, is to play one of Amazon’s own sound files. The available sounds can be found at: Alexa Skills Kit Sound Library | Alexa Skills Kit

These can be called as follows:

#Alexa Devices

action: alexa_devices.send_sound
data:
  sound: amzn_sfx_doorbell_chime_01
  device_id: ****YOUR_DEVICE_ID****
#Alexa Media Player

action: media_player.play_media
target:
  entity_id: media_player.office_echo
data:
  media_content_type: sound
  media_content_id: amzn_sfx_doorbell_chime_01
3 Likes

Apologies, you’re right, the automations I use are playing the mp3 on the unifi doorbell itself

Hello hottl,

Might try this…

      data:
        media_content_type: mp3
        media_content_id: media-source://media_source/local/chime.mp3
      action: media_player.play_media

My media files are stored like this…
For me in configuration.yaml

homeassistant:
  media_dirs:
    local: /media

Then the /media path becomes part of /local .
And put the mp3 in a folder in HA under

/media/mp3

(The media folder already exists, you would want to add a sub folder to that, or at least I did, to keep your OCD happy.)
When I want to use an MP3, the path is

media-source://media_source/local/mp3/Ships_Bell_4.mp3

Adjust as you desire, but that is a basic version of mine.
Longer version in here: HA Config

Tested and it doesn’t work with Alexa device - as @Didgeridrew said

Is there already a solution or a workaround for this?

Please clarify what you are asking.

The issues in the thread you opened are answered in my post above. You must use Alexa’s Notify platform, and .wav files are not acceptable under Alexa’s requirements.