Echo Devices (Alexa) as Media Player - Testers Needed

NOTE: Because of the age of this thread, we can’t edit the first post anymore and it is outdated. For current installation instructions and latest information, please see the Wiki.

I’m excited to share with you all a component that I have been working on for the last week that allows controlling amazon echo devices (and clones) directly in home assistant! :slight_smile:

What This Is:

This topic and this post is a place I hope to use to collaborate with enthusiastic Home Assistant users that want to see this component become the best it possibly can be. What I hope for is that we can each test and debug features within our skill set to make sure that once submitted for code review to be integrated into an official home assistant component that it will be a seamless experience for all users that wish to enable it.

For anyone who wishes to install the custom component and hassio add-on (or docker container) be aware that this component is absolutely still a work in progress and may have currently unforeseen issues. With that said

What It Does:

Allows for control of Amazon Echo products as home assistant media devices with the following features:

  • Play/Pause/Stop
  • Next/Previous (Track)
  • Volume
  • Retrieval for displaying in home assistant of:
    • Song Title
    • Artists Name
    • Album Name
    • Album Image



A home assistant component that, like any other, defines a device and its attributes for home assistant to digest and ultimately show you on the HA GUI. The second part is a node.js API that creates a session with the web interface and sends commands using the retrieved session tokens.

I cannot take all the credit for the component and while I haven’t spoken to either of the following people directly I want to say:

A huge thanks goes to Alexander Noack @ his work of inspecting the Alexa web interface and reverse engineering amazon’s APIs for use in a shell script is what makes this comment possible.

I also want to thank Noel @ for laying the groundwork for getting nightmare in node.js working for the website. This allows getting the session cookies easily.

# Design Choices

node.js has been chosen as the backend API because it allows for easy retrieval of the session cookies used for calling the APIs discovered by Alexander. I attempted for a while to discover a similar way of doing this inside python to make everything HA native, but unfortunately couldn’t. This is either because amazon locks down python scripts working this way or some javascript is needed for the login process that node.js can easily handle. What this means is that we end up with both a component and a hassio add-on to make things work.

Installation of Custom Component

Installing the custom component

First thing is to download the custom_componet from @ This file will be placed in your config directory under a folder named custom_components/media_player. If these folders do not exist you can add them.

Once there you’ll need to update your config to include the following:

  - platform: alexa
    email: “your amazon email”
    password: “your amazon password”
    url: “”

Once set, reboot and you should see all your Alexa devices in home assistant

Known Bugs and Issues

  1. Whole Home Audio Devices have no working volume reporting (controls still work via service commands)
  2. Unknown support for Alexa clones (but works on a Roav VIVA)
  3. Media Players that haven’t played music in a while go into an unknown state (this is because Amazon doesn’t keep the playlist active). Request a song from the play_media service
  4. As above, currently no way to tell Alexa what playlist/song/artist you want to hear directly from HA (this is coming soon) DONE
  5. May not work with other media providers like Pandora, Tune-In, Spotify (FIXED)

Notable Additional Features

Text-to-Speech - Can be invoked from the HA UI services menu. media_player.alexa_tts and requires a payload like this:

{"entity_id": "media_player.bedroom_echo_dot", "message": "Test message"}

Online status of devices - Additional attribute to tell you if the Alexa device is online (extremely useful if you want to send a TTS after one has come back online (such as one in a vehicle)

Going forward

To those who made it all the way to the bottom of this extremely long post thank you so much! I hope that it was sufficiently informative for you to get it setup to start testing in your home assistant install. I really do humbly appreciate anyone who provides feedback and comments of any kind (including constructive criticism) so please feel free to leave a reply for anything and everything.

Updated above but also see [Echo Devices (Alexa) as Media Player - Testers Needed]


How to install on hassbian?

1 Like

I would LOVE to help test this out as I mainly use my dots for everything and have been waiting for the day for something like this to surface. Unfortunately I’m using hassbian. Do you have an install method for hassbian users for the addon? I already have node.js installed and working with the amazon dash buttons so it shouldn’t be too difficult.

For those on hassbian I do not currently have it setup, but I can work to get a hassbian install on a spare raspberry pi and see if I can get some type of installation for those of you on that platform.

@3vasi0n since you already have node.js running. You can take a look here:

This contains the node-js code for the Alexa API. You’ll need to setup environment variables USER for your amazon username and PASS for your amazon password like this in console. You’ll also need to install the dependences for the project:

npm install 


yarn install
# Setup environment vars
export USER; export PASS

Then you can simply run the index.js node file

node index.js

You may also need to change the host in the custom Alexa component from addon_9ff8aed5_alexaapi to whatever your IP is for hassbian.

Again no guarantees this will work, but I’ll try to look at hassbian tomorrow and see if I can simplify any steps.

What would i need to adjust to make it work with Or does it automatically work with different countries?

@AlmostSerious, no code to automatically select country, but it might work regardless. Could you test and report back?

How do I know if it’s successful after running node index.js? THere’s no error shown or logs to check. I tried doing netstat for process listening on port 8091 but it returns 0 result.

@accelle, should have a log output showing “Logged in” followed by “Internal endpoint:”

By the way, that link doesn’t work. I think you wanted to write:

I’m getting this error from the addon:
[FATAL tini (9)] exec /entrypoint failed: Exec format error

What’s wrong?

@keatontaylor Can this component be used to play songs etc on echo devices using Homeassistant?

Not yet. Here’s what @keatontaylor said about this in the initial post:

1 Like

I’ve the same error

Will do :slight_smile: However, currently i am getting the same error as John1, so cannot advance in testing your component:

[FATAL tini (9)] exec /entrypoint failed: Exec format error

Awesome - would love to try this out. are you planning to support HA sending media files to play? I’m thinking alarm/cuckoo clock type sounds as part of the “TTS” system…

1 Like

Getting same error:
[FATAL tini (9)] exec /entrypoint failed: Exec format error

same error here

Sorry guys for the error, this is due to me not cross compiling the add-on right. Working on it now and will post soon.

For those who were experiencing issues I’ve released an update. You should be able to install it and get a working version. Please let me know! :slight_smile:

I tried doing what I could but I was unsuccessful at getting it set up. I think part of the reason why is because I run my system on my unraid server and my node.js is in a separate docker container. I’ll fiddle around with it more in a few hours when I can get more time.