Echo Devices (Alexa) as Media Player - Testers Needed

I for one, am from Romania, and we have very good internet subscriptions here. Currently I have an active 1Gbps subscription, and [alexa.amazon.com] is snappy as a kitten … :slight_smile:

I’ve been getting quite a few in my logs from the uk servers throughout today, although I think something has not been quite right with the amazon servers today, as a couple of times today, Alexa has responded that it has no internet connection, despite there being one!

Not so bothered by the media player at the moment but if you adjust the volume does that change the general alexa volume.

Hoping so as want to automate the changing of the volume of the upstairs alexa when the kids go to bed but not yet found a solution to this

1 Like

@keatontaylor Any chance to allow multiple accounts in the future?

I was able to get this working before, (with the addon), by running x2 docker containers running on different ports then modifying/duplicating alexa.py, but can’t seem to wrap my head around how to do this now.

Before is was just as simple as naming the components ( alexa_01.py, alexa_02.py, etc… )

alexa_01.py

ALEXA_DATA ="alexa_media_01"
SERVICE_ALEXA_TTS = 'alexa_tts_01

alexa_02.py

ALEXA_DATA ="alexa_media_02"
SERVICE_ALEXA_TTS = 'alexa_tts_02

and changing the port numbers to reflect the docker container ports.

( This is going off memory )

This would be useful for households with multiple Devices but each Device may be associated with a different account.
Siblings, Couples, Roommates, Parents/Kids, etc…

Just downloaded, and created HA Docker Container for HA 0.74.0 … and this showed up:

Log Details (WARNING)
Fri Jul 20 2018 23:17:53 GMT+0300 (Eastern European Summer Time)

You are using a custom component for media_player.alexa which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

I hope it’s just a warning and does not have any deeper implications.

Just a warning. I think HA just wants to discourage the use of custom components, but hey I prefer to get others to test before submitting it to be official.

Roger that captain !

I haven’t really tried multiple accounts and if you can get it working I’d be happy to see what changes you have made. I may look into it more in the future and make it work natively, but there is a lot more to get done before that is at the top of the list.

Thinking about it a bit though, I think the changes are ALEXA_DATA, SERVICE_ALEXA_TTS should be the only two unique services. Other than that you’ll need to ensure that you have login details for both.

media_player:
  - platform: alexa_01
    email: [email protected]
    password: your pass
    url: amazon.com

media_player:
  - platform: alexa_02
    email: [email protected]
    password: your pass
    url: amazon.com

Is anyone else still struggling on the captcha?

1 Like

everybody … but it works from the first try

That’s where I’m at, and that kinda works, up until you have to enter the CAPTCHA/Configure.

The first account will authenticate fine and work as expected, but it doesn’t allow any more to be authenticated after that.

See what we mean by lots of messages :slight_smile:

… and sometimes there are a lot more

I can’t get through catcha. Any idea how to fix this. I don’t see anything in the logs

Here’s something to try for those dealing with Captcha not showing issues, I had a small issue with the Captcha after upgrading to HA 0.74.0…

  • Delete the "custom_components/media_player/__pycache__" folder.
  • Restart HA
  • Hard refresh the HA page in your browser.

On Windows/Linux, Hold down Ctrl and press F5 for Chrome/Firefox/Edge…
On Mac, Hold ⇧ Shift and click the Reload button for Chrome/Firefox.

I find a Hard refresh usually fixes 99% of my frontend issues with updates or new components. If anything it’s something to check off the list since I haven’t seen it mentioned yet.

Issue is from those who have long ping times to US (i.e. AU/ NZ, etc.)
I get the same ‘update’ error timing (and always have since you first made this module).
Internet on this side of the planet uses a carrier pigeon sometimes :-/

Trying url: alexa.amazon.com gives an error,

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘www.alexa.amazon.com’, port=443): Max retries exceeded with url: /gp/sign-in.html (Caused by NewConnectionError(‘<urllib3.connection.VerifiedHTTPSConnection object at 0x7f833682b0>: Failed to establish a new connection: [Errno -2] Name does not resolve’,))

using url: amazon.com.au results in no captcha being requested.

Which url value i need to use for germany?


alexa.amazon.de
or also

I guess it’s where your account is registered. I bought my Echo from Amazon.co.uk but my account is on amazon.com, so I use .com

Doesn’t matter which country you are from, or which country you are travelling to now, let’s say.
All it matters is the domain of the account that has the Alexa / Echo devices binded to it.
I have amazon accounts on .com, .uk, .au, but my devices are all on amazon.com … so .com it is for me.

If the .com website has high latency there isn’t much that I can do. The major issue with increasing the update interval is that it will increase the time it takes for the comment to see state changes in the media players. So say if I increased it to 30 seconds, it would mean it could take up to 30 seconds for a media player to show the next song title or album art when the echo moves to a new song.

The only real option would be to allow the user to set the update interval for themselves, so that they could decide just what is acceptable.

Update! - Login Issue Potentially resolved

I applied a fix today that instead of checking the login page for a specific keyword/phrase tries to gather a list of echo devices as a means of checking if login was successful. This should work better for those in other regions that the language is something other than English.

As always the code can be found on my GitHub [https://github.com/keatontaylor/custom_components/blob/master/media_player/alexa.py]

Please ensure when downloading that you you ‘VERSION: 0.7.1’ in the file

I wanted to also take a moment to discuss the future of this project. First let me outline what still needs to be done.

  1. Verify that login is working for users
  2. Upload the Alexa Login / Alexa API code to PyPi (pip)
  3. Ensure the component passes all tests/linting for HA
  4. General cleanup and refactor
  5. Submit to HA

If you see any omissions in my list above, please let me know. :slight_smile:

1 Like