Skip to content

Instantly share code, notes, and snippets.

@MarkWattTech
Created April 22, 2021 17:11
Show Gist options
  • Save MarkWattTech/df717195583ecb8a0b1cd6b1ffb78138 to your computer and use it in GitHub Desktop.
Save MarkWattTech/df717195583ecb8a0b1cd6b1ffb78138 to your computer and use it in GitHub Desktop.
Supporting content for the Alexa Custom MP3s video
#Dev Tool
service: notify.alexa_media
data:
message: "<audio src='https://yourPublicURL.ui.nabu.casa/local/mp3/potato.mp3'/>"
target: media_player.downstairs_echo
data:
type: tts
# Script for a random phrase
service: notify.alexa_media
data_template:
message: >
'"{{ ("<audio
src='https://yourPublicURL.ui.nabu.casa/local/mp3/potato.mp3/>",
"<audio src='https://yourPublicURL.ui.nabu.casa/local/mp3/potato.mp3'/>",
"<audio src='https://yourPublicURL.ui.nabu.casa/local/mp3/potato.mp3'/>"
)|random }}"'
data:
type: tts
target: media_player.downstairs_echo
@donparlor
Copy link

donparlor commented May 16, 2023

I am using duckdns and the only option that worked for me was using AWS S3 account storage. Alexa is over-protected regarding access to files so they will only allow accessing files on their own servers. Prove me wrong as I would be more than happy to store files locally on my Home Assistant local www/media/audio folder.

Here are some details:

  1. Make sure your mp3 file is the correct bitrate / length
  2. Amazon S3 account (for your region)
  3. Set S3 permissions, public access and bucket policy
  4. Use you S3 link: example: <audio src="https://MyFileCompartmentName.s3.us-west-1.amazonaws.com/zelda.mp3'/>"

@dmayo305
Copy link

Anybody have success sending to a group of echoes rather than a single echo?

@BeyondCurious
Copy link

BeyondCurious commented Oct 7, 2023

@dmayo305, Just use a dash with each echo in your YAML:

service: notify.alexa_media
data:
  message: >-
    <audio
    src='https://myPublicURL.ui.nabu.casa/local/mp3/doorbell-chime.mp3'/>
  target:
    - media_player.colton_s_echo_show
    - media_player.apartment_door_echo_amz
    - media_player.bedroom_echo_right_amz
    - media_player.kitchen_echo_plus_amz
    - media_player.bathroom_echo_amz
    - media_player.bedroom_echo_right_amz
  data:
    type: tts
enabled: true

@rhmunich
Copy link

I had the same problem with "Simon says ...". Finally, I could fix it by correcting the source-statement of the mp3-file.
It seems that the source needs to be like this (watch the different quotation marks):

src='https://abcdef.ui.nabu.casa/local/mp3/Alarm.mp3'/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment