At our house, we use Alexa a lot. In fact, we have an Echo Dot in almost every room. Alexa has been great at controlling our smart home devices. But we also listen to a lot of music. Until recently we couldn’t use home assistant to play music through the amazon echo. But now thanks to the work of some really awesome Home Assistant users, we can.\

To use Alexa as a media player in Home Assistant, we need to do 2 things. We need to install a new add on, and make some additions to the configuration.yaml file. First let’s add the add on. Go to the Hass.io tab, then click on the add on store. And then where it says “Add New Repository URL”, paste in https://github.com/keatontaylor/hassio-addons.Once you paste it in, scroll to the bottom, and you should see an “Alexa Media Player API” add on. Click on it, than install it. When it’s finished, go to the “Config” box and where it says Username and Password put in your Amazon Username and Password. Than under URL, put https://alexa.amazon.com but if you live somewhere where they don’t use .com, you need to change it to whatever you country uses. Also make sure that there are quotation marks around whatever you put in those boxes. The text will turn Red if you are not correctly using the correct Json format. When you have done that, hit save, and than start. Now refresh the log, and if eventually it says “logged in, you did it right. https://github.com/keatontaylor Go back to Keaton’s github page to find the Alexa.py script that you may need. Copy and paste the entire thing into a new file and name it Alexa.py. You’ll want to save it to the custom_components/media_player. If you haven’t created the folders yet, do so now.

Now we get to add a line to our configuration.yaml file. If you don’t already have a main header for media player, do so now. Once you have a heading, you can now add a line for Alexa. Now you can save and restart Home Assistant. Even when I make small changes, I always check the config check before I restart, just to make sure that I didn’t screw anything up. As soon as Home Assistant starts back up, you can see a bunch of new media players on your dash. It’ll include all of your Amazon Echoes, and any Fire TVs or tablets, you may have. Now when Alexa is playing music, you can see it in Home Assistant. The first time you play music, you may have to press the little power button next to the media player, but after that, it should show up. You can play, skip, reverse, and change the volume, all from HA. You still have to use your voice to tell Alexa what to play and where it’s from, but once it’s playing, Home Assistant has control. Home Assistant will eventually will be able to control where it comes from. Something else that has been updated is Home Assistant can now do text to speech through Alexa.

Doing text to speech for Alexa isn’t much different than doing it for Google Home. The service is Media Player Alexa TTS. That is different. You will also need to know the entity ID for the Alexa that you want to use. You can find the list of all your amazon devices on the states page. So back on the service page set the entity ID. Than you can put whatever you want in the text box. So far, the text to speech command only works if Music is already playing.

So that’s it. It may not be perfect yet, but so far it’s been fantastic. Thanks to Keaton for doing some awesome things! Keep up the good work!
Until next time,

Adios