Echo Devices (Alexa) as Media Player - Testers Needed

@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

@clyra, I do need to fix this and do a test if the xvfb display is already set.

@planet4 make sure you’re also using the most up-to-date version of the custom_component as well. it will have the VERSION 0.4 in the top comment block

Advice on Dilemma

I have been trying to get code to work for play_media so that you could select playlists/songs/stations to playback and wanted to discuss some of the issues with implementing it in hopes of getting feedback.

The major issue is that content ids need to be provided specific to the content type and provider. Now I can code this and allow the user to select the content type and ID via the play_media service, but the IDs are not human readable and not something that can be easily queryable by the user.

My thinking was that I would use the select_source method to allow a visual representation of all playlists/stations that can be selected for prime music, but unfortunately this will be limited to prime music if I went this route.

The other alternative is to provide the IDs necessary to playback that specific content when that content is playing. So a user could request Alexa to play Spotify and gather the ID from the media_players attributes and use that for automatons to play that song/playlist/album again

I’m not really sure what would be the best user experience so I want to get thoughts from all of those that have been so helpful in testing things.

I also wanted to try it. But when I press install I get this message:

18-07-09 20:30:52 INFO (SyncWorker_18) [hassio.docker.interface] Pull image keatontaylor/armhf-addon-alexa-api tag 0.4.
18-07-09 20:31:01 ERROR (SyncWorker_18) [hassio.docker.interface] Can't install keatontaylor/armhf-addon-alexa-api:0.4 -> 404 Client Error: Not Found ("no such image: keatontaylor/armhf-addon-alexa-api:0.4: No such image: keatontaylor/armhf-addon-alexa-api:0.4")

Hass anyone an idea?

Hmm, ran the command in docker on my machine and not get the 404. Could I get some more information. Are you running on a raspberry pi and what is your region/country.

Thanks for your support. Of course you can:

Raspberry Pi 3 with hass.io and germany (BW)

Other Add-Ons are working fine. So I don’t unterstand it at the moment.

Hi keatontaylor,

Thanks alot for the component . Do you plan by any chance to introduce the feature to connect to a Bluetooth device ? It was part of the shell script project you mentioned . It would be awesome to manage this over home assistant too.
I’m
Greetings

@nimey, absolutely!

@PrivatHomeServer not sure, I can pull it manually just fine copying the output from your logs. I also don’t think that docker hub has any region specific requirements. If you’re familiar with docker command line could you run:

docker pull keatontaylor/armhf-addon-alexa-api:0.4

and post the output?

My vote would be to “provide the ID’s necessary to playback that specific content when the content is playing”. I believe that is how the spotify component currently does it, so I would think it would make sense to stay consistent. Not sure if other components handle it the same way or not.

You can send playlists to spotify via the “media_content_type”: “playlist” and “media_content_id”: “spotify:user:spotify:playlist:37i9dQZF1DWSkkUxEhrBdF” which are a part of the media_player.play_media service, you can test this from the services control panel in the Home Assistant frontend.

Since I started playing with this code today Alexa keeps repeating something about “Simon Says”. Has anyone else had that? So far it only seems to happen on my Echo Show.

I guess she will repeat what you say if you say “Simon Says”. My wife thinks it triggers when it sees us move. I’ve disabled the code because we’re watching a movie. I will try to do more testing tomorrow.

@BrianHanifin, the way the TTS works is that is calls the same code that routines call if you had them speak something custom. On the amazon backend it is simply instructing the echo to say something as if you asked "Simon Says, ", hence the reason for the history showing that.

AMAZON REQUESTING CAPTCHA

I am also having the issue where Amazon is asking for captcha, I cant figure out how to get this addon to successfully login.

Im getting the “TypeError: Cannot read property ‘alexaURL’ of null” even tho my username and password is correct.

Does anyone have a solution for completing the captcha or allowing this addon to successfully login?

@J.eremy make sure that the settings in the plug-in are as follows. (with your settings of-course)

{
  "username": "[email protected]",
  "password": "mysupersecretamazonpassword",
  "url": "https://alexa.amazon.com"
}

The reason for using nightmare.js for the login was to avoid the captcha issues that plagued the shell/bash script written by others. So I’d double check that the above settings are absolutely correct and for the correct region that you live in, especially the URL.

Just sharing a tiny video demo’ing this awesome integration! https://youtu.be/YTVLrf9uX0M

@keatontaylor thx, solid stuff thus far!

2 Likes

Unfortunately, she is speaking for 15-20 seconds, explaining in detail how to use the Simon Says feature. I will experiment with it more later to try to narrow down what is triggering it.

Hi

Cant you store a mapping table between ids and readable names, then use the names within the component/frontend. Whenever a user selects something you can then search for right id in your mapping table?

Regards

Those are my exact settings with my correct credentials obviously lol, Its showing the URL correctly but then also saying there is an error and then the URL error is presented.

Here is my log
https://pastebin.com/7pexmW4v

I have tried uninstalling and reinstalling with no results. I have also logged into the alexa webpage with the login details in the config so I know those are correct.

The region is also correct as I am in the US

@J.eremy
@keatontaylor

exactly my same error