Echo Devices (Alexa) as Media Player - Testers Needed

Just ran into another issue with the login. Looks like the captcha is not always the only thing that amazon requires to login this way. Sometimes you get an email verification link that is required to proceed. I’ll have to work this into the auth flow. So for those having issues where it keeps asking for the captcha this could be the issue.

amazing work,
please could these work with your skill https://github.com/home-assistant/home-assistant/pull/15320

I have placed the custom component under custom_coponents/media_player/alexa.py.

I then have added the following

media_player:
  - platform: alexa
    email: "my email"
    password: "my password"
    url: alexa.amazon.com

I am not getting any errors but I am not getting any Alexa media players discovered, am I missing something?

1 Like

no quote and double quote, no need alexa in front amazon.com

media_player:
  - platform: alexa
    email: my email
    password: my password
    url: amazon.com
2 Likes

that did the trick, cheers.

I now get the capture screen but can’t see the capture characters, I input something random in the hopes it will pop up again with the characters but the capture screen never pops back up.

same thing is happening to me. I can get it to work sometimes but then it will disconnect shortly after

Did you have lxml and bs4 installed?

Try logging out of HA in your browser, doing a hard refresh as suggested by @VladTepz.

Then log back in and try again. I never get the Captcha first time either, just random text. I type in some letter, hit enter, then try again. 2nd time always works for some reason.

Alas it did not make a difference still can’t see the capture characters if I input anything it never pops back up unless I reboot. Using hassio 0.73.1 RPi 3b

I tested the newest version again. To see if it works now for germany. But it failed with the following errors in the logs:

2018-07-22 12:33:22 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/media_player/alexa.py", line 173, in setup_alexa
    update_devices()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 318, in wrapper
    result = method(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 318, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/media_player/alexa.py", line 129, in update_devices
    devices = devices.json()['devices']
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 896, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 8 column 1 (char 7)

Any idea what that means?

2 Likes

Getting exactly the same error as you lweberru

But for UK, I get the captcha then all I see is that error every minute or so, I tried some changes in the python like en-US to en-GB and different URLS - just ends up not working with no error messages,

Anyone any ideas ?

Cheers

I’m getting this error on 0.7.1 and the captcha also not working in this version. On 0.7 its working fine.
image

@keatontaylor brilliant works superbly. Is it possible you could add BBC as a media content as echo/dot still showing idle when BCC radio is playing (BBC is the default player in UK )

many thanks for all your work

@lonebaggie the same happens with podcasts here

OK, after a lot of playing around. JSON falls over something to do with the python checking ‘devices’ to validate the logon has worked. I assume UK and Germany has something different to US. So I reverted to the previous version. 0.7 and it works fine as this doesn’t check using the devices method.

Im not a programmer but the error seems to be caused by JSON being passed possibly an empty string ?

For consistency the TTS may need to be split off as a platform of the TTS component.

This might be a challenge, as it would mean you would be required to setup both a TTS for alexa_media_player (it isn’t amazon poly) and one for actually TTS that other services would use.

1 Like

Yeah, I thought it might be problematic. I am happy with it as is, it works. :slight_smile:

I am running 0.7.1. I am finding that if I don’t answer the CAPTCHA right away, the image is broken. Right clicking and opening that image in a new window reveals:

<Error>
  <Code>AccessDenied</Code>
  <Message>Request has expired</Message>
  <Expires>2018-07-22T16:49:27Z</Expires>
  <ServerTime>2018-07-22T16:50:06Z</ServerTime>
  <RequestId>F14...C7C</RequestId>
  <HostId>
    1l+sl6wJ0...XS4fG+0=
  </HostId>
</Error>

How does the built in Device Discovery or Integrations code handle setting up new components? Could the login be delayed until we are ready to enter the CAPTCHA? Instead of logging in right away, it could happen when we click “CONFIGURE”.

Also, how are these login authentications saved with other components? There has to be a way to save an an authorization so we don’t have to reenter it every time we restart HASS, right?

This exactly the same error I get I never get to the captcha before the “request has expired”

1 Like