Echo Devices (Alexa) as Media Player - Testers Needed

I have this installed and can confirm that you can change the volume of your echo

@keatontaylor - fantastic work. Really appreciate sharing!

@shire210 Great, how did you manage that? I’m just a HA beginner :wink:

To adjust the volume? Once you add the component, there is a volume slider that you can adjust:
image

Or you can do it as a script/automation:

    - service: media_player.volume_set
      data:
        entity_id: media_player.office_dot
        volume_level: .6
1 Like

Thanks a lot !!!
Now have to find a way to save the previous volume_level before rising volume and restore that level after the message.
I use my echo mainly for background music/radio, so with low volume, and then the volume level of a message is to low.

1 Like

Volume is a bit tricky. There needs to be an active queue (playing or not) for the volume controls to work. This is a limitation of the unofficial API that the Alexa website users.

Hi @keatontaylor ,

I guess I missed something, but:

# docker pull ketaontaylor/amd64-addon-alexa-api
Using default tag: latest
Error response from daemon: pull access denied for ketaontaylor/amd64-addon-alexa-api, repository does not exist or may require 'docker login'

sorry… my bad. Just did a copy/paste and later noticed that keatontaylor was misspelled.

1 Like

:sweat_smile: Apparently I seem to misspell my name.

1 Like

Just installed your addon, simply awesome! Media Control, Cover display, Volume Control, TTS, all is working great!

Any chance to get instructions to use with a docker instance of HA on unraid? I tried to pull the docker image but received error.
root@TornTower:~# sudo docker pull ketaontaylor/amd64-addon-alexa-api
Using default tag: latest
Error response from daemon: pull access denied for ketaontaylor/amd64-addon-alexa-api, repository does not exist or may require ‘docker login’

1 Like

@Charles_Brown, there was a typo in the docker pull command. (my name no less)

docker pull keatontaylor/amd64-addon-alexa-api 

Follow the rest of the instructions above for the rest.

How would i use this within node-red? ive tried a service call node with

Domain: media_player

Service: alexa_tts

Data: {“entity_id”:“media_player.office_dot”,“message”:“Test message”}

I can call the service from within HA and it works fine just dont know how to use it within node red.

2 Likes

Thank you. I got the docker image installed. There was a trick to it though, I had to specify the “tag” since there was no “latest” tag available.

keatontaylor/amd64-addon-alexa-api:0.4

I created a config.json file and populated it with my Alexa login info. Then I added alexa.py to my Home Assistant /custom_components/media_player directory.

Thank you. I got the docker image installed. There was a trick to it though, I had to specify the “tag” since there was no “latest” tag available.

keatontaylor/amd64-addon-alexa-api:0.4

I created a config.json file and populated it with my Alexa login info. Then I added alexa.py to my Home Assistant /custom_components/media_player directory.

Ignore the following section. I figured out my mistake, I did not read the first post before adding my media_player definition. I was trying to manually define each echo device.

Everything worked just fine until I installed 0.4 and HA 0.73.1. Now it wont find the entity mediaplayer.alexa… Anyone alse who have the same error?

You should use the docker IP, not the device IP.

It seems that the docker image doesn’t play very well with portainer. If you try to restart it from portainer you got this on the logs:

Fatal server error:
(EE) Server is already active for display 99
    If this server is no longer running, remove /tmp/.X99-lock
    and start again.

any hints?

Here is how I have it set up in Unraid. based on your eror message, I think you need to include the tag “:0.4” on the end of the repository name.

1 Like

@keatontaylor thank you for the component
trying follow the container installation, but getting these errors in the docker log

Mon, 09 Jul 2018 12:40:53 GMT nightmare running
There was an errorInternal endpoint: 
curl -X POST -d "tts=Ask Alexa team for a proper TTS API" -d "deviceSerialNumber=deviceSerialNumber" http://localhost:8091/alexa-ttst request for getDevicesTypeError: 
Cannot read property 'alexaURL' of null
    at Object.getDevices (/workspace/alexa-api.js:180:19)
    at /workspace/index.js:29:13
    at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
    at next (/workspace/node_modules/express/lib/router/route.js:137:13)
    at urlencodedParser (/workspace/node_modules/body-parser/lib/types/urlencoded.js:100:7)
    at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
    at next (/workspace/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/workspace/node_modules/express/lib/router/route.js:112:3)    at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
    at /workspace/node_modules/express/lib/router/index.js:281:22

@keatontaylor Oops. I incorrectly explicitly referenced individual Echo devices. I went back and reread the first post and realized all I needed to do was call the platform once.

media_player:
  - platform: alexa

Now I am getting the following error.

Could not connect to alexa server at http://addon_9ff8aed5_alexaapi (HTTPConnectionPool(host='addon_9ff8aed5_alexaapi', port=8091): Max retries exceeded with url: /alexa-getDevices (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbe55ea9710>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)))

@clyra Thank you for that! Updating my definition to the following resolved all errors. Now to get to testing

media_player:
  - platform: alexa
    host: 10.0.0.20

Oh YEAH! I was just able to send TTS that played through my Echo Show’s speakers!!!

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

FYI, here is how I added your Alexa API to my docker-compose.yaml.

  alexa_api:
    container_name: alexa_api
    image: keatontaylor/amd64-addon-alexa-api:0.4
    environment:
      - TZ=America/Los_Angeles # offset = -08:00 / DST -07:00
      - PGID=1004
      - PUID=1000
    ports:
      - 8091:8091
    restart: unless-stopped
    volumes:
      - /opt/alexa_api:/data
      - /etc/localtime:/etc/localtime:ro

The PGID & PUID may not be necessary, but I recently started using it in all of my containers by default just in case.

1 Like