Playing Custom Sounds on Amazon Alexa with Home Assistant

Playing Custom Sounds on Amazon Alexa with Home Assistant

For Amazon Alexa users, integrating custom sounds or music into your smart home setup can greatly enhance the experience. I was looking everywhere for a way to play a barking dog sound for my home security, but you can use the following technique for any sounds of songs you like. This guide will show you how to achieve it using Home Assistant and the Alexa Media Player integration.

Step-by-Step Guide

1. Install Alexa Media Player Integration

First, if you haven’t already, download and install the Alexa Media Player integration using HACS. You can find detailed instructions here. This integration is incredibly useful for playing sounds through Alexa devices, I’m using it for a lot of other things as well.

2. Create an Account on JukeHost

Next, create a free account on JukeHost. This service allows you to upload sounds to their system and provides you with a URL for each uploaded sound. This is essential for the next steps.

3. Upload Your Sound

After creating your JukeHost account, upload the sound you want to play. Once uploaded, JukeHost will provide you with a URL for the sound. Simply append .mp3 to the URL if it doesn’t already have it.

4. Create the Automation in Home Assistant

Now, create an automation in Home Assistant to play the uploaded sound. Use the following YAML code, replacing the placeholder with the URL you got from JukeHost:

service: notify.alexa_media
data:
  message: >-
    <audio
    src='The URL you got from JukeHost and add .mp3 at the end if it didnt come with one. Make sure this URL is in quotes here' />
  data:
    type: tts
  target: media_player.kitchen_echo
alias: Dog bark sound

With this automation, your Echo device will play the specified audio. It’s super simple and doesn’t require any complex conversion or specific formats.

Summary

By using the Alexa Media Player integration and JukeHost, you can easily play custom sounds or music through your Alexa devices. Whether it’s for security purposes or just to enjoy your favorite tunes, this method is straightforward and effective.


3 Comments

Leave a Reply