Echo Devices (Alexa) as Media Player - Testers Needed

Tried to use this for my Hassio install and didn’t work. Anyone able to strip this out of a docker Hassio install>?

For everyone who is having trouble with the CAPTCHA when you reboot, here is what I’ve done that seems to work for me so far. Before I reboot, I delete the ----cache---- folder located the following path: .../custom_components/media_player
During the restart it will recreate the cache folder (and sometime I delete it again just for good measure, not sure it is necessary)

I’m running the latest HASSIO 0.74.2 and Alexa.py version 0.7.1. If you are not getting the CAPTCHA in the first place you may want to delete the cache, refresh your browser and reboot.

Happy automating.

updated my hass.io to 75.1 and now after i put the captcha in it says Error doing job: Future exception was never retrieved in my hass.io error log, and ive tried to restart and reset the raspberry pi but does the same every time.

@Smartmedia

(and for others, this is related to the JSON error many people are getting)

I did this, but i wasnt getting that flash error. However, all that said, it NOW WORKS
i was looking at your screenshot - where it has a button that says to send a code to login… then it hit me… 2-factor authentication. i disabled mine… and then did the elaborate login/logout/etc… and bam… .all works
also, its worth saying that I am NOT doing this from the computer where home assistant is installed. HA (not hass.io) is on an docker hosted on an archlinux system (in my house, but separate).

For everyone else, the JSON error (simplejson.errors.JSONDecodeError: Expecting value: line 8 column 1 (char 7)) effectively means that it FAILED to LOGIN.

I noticed that when I was success, i got another dialog box on my home assisstant front-end after the captcha… it had nothing in it - i had to X out. I believe we need a better ‘success’ message than this, and also better checking that we had a successful login… all it does now is see if the word ‘devices’ is included in the web page response!!! thats the real error here. should i code the correction? i learned python for this so i might as well use it!

now to see if i can re-enable 2-factor authentication…
ANSWER: No… Turning that back on breaks it directly.

Log Details (ERROR)
Sun Aug 05 2018 22:03:50 GMT+0100 (British Summer Time)

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 325, in wrapper
result = method(*args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/util/init.py”, line 325, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/media_player/alexa.py”, line 144, in update_devices
update_devices, url)
File “/config/custom_components/media_player/alexa.py”, line 209, in init
self.refresh(device)
File “/config/custom_components/media_player/alexa.py”, line 253, in refresh
self._media_image_url = self._session[‘mainArt’][‘url’]
KeyError: ‘url’

thats from my logs, cant get alexa to work again even after downgrading to 74.1 its now screwed :confused:

im having the same issue too, the echo lights up but no sound is heard.

This is fixed in the next version coming out. You’ve successfully logged in, but for some reason your Alexa device isn’t providing a URL for the artwork. If you need the fix early, see my earlier posts.

New Version 0.8.0

Big thanks to @alandtse who single handedly worked on getting changes in place to solve a lot of the lingering issues with login. Please report your findings and let us know if it is working better for you.

Note: Please ensure when downloaded you are grabbing: ‘VERSION: 0.8.0’

Other improvements:

  1. Session cookies stored in config, no longer required to type captcha in after HA reboot
  2. Linting fixed 100% for eventually submitting to home assistant
  3. Additional logging and catching of errors
  4. Captcha configurator now shows proper error messages.

Thanks again @alandtse for the changes! If you see anything else you want to add here that I overlooked let me know!

Just installed this (v 0.8.0 and am stuck in a constant captcha loop. My config is:

  - platform: alexa
    email: [email protected]
    password: password
    url: amazon.com

I don’t know if it makes a difference that I’m in Australia but my account is US. I just get a constant captcha loop, telling me it can’t login, even though I’m sure I’m doing the captcha right.

Thanks!

My config looks like yours but all I am getting after a reboot is the following error.

The following components and platforms could not be set up:

media_player.alexa
Please check your config.

Unable to prepare setup for platform media_player.alexa: Could not install all requirements.

1 Like

Hey thebdizzle - I just installed 0.8.0 and so far seems to be working well. Captcha first time and then after a reboot, all my alexas came back up without needing another captcha.

I too am in Australia using the US amazon account so I am not sure that is causing your issue.

My configuration is pretty much exactly like yours except I am using quotes around email, password and url attributes.

Keaton - great job mate - this has taken my home automation to a whole new level!

0.8 works on my hass dev environment on docker. However, I already tried different troubleshooting on my HASS venv but still fails.
I ended up copying the alexa_media.pickle from the dev to my production environment. It worked and it was able to discover my alexa devices

I tryed alexa.py 0.8 and are running it on Hassio (0.75.1) in Docker.
i got this error:

2018-08-06 11:00:33 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package lxml==4.2.3: Failed building wheel for lxml

wirelesstagpy 0.3.0 has requirement colorlog==3.0.1, but you’ll have colorlog 3.1.4 which is incompatible.
waterfurnace 0.4.0 has requirement websocket-client>=0.46, but you’ll have websocket-client 0.37.0 which is incompatible.
upsmychoice 1.0.6 has requirement beautifulsoup4==4.5.1, but you’ll have beautifulsoup4 4.6.0 which is incompatible.
upsmychoice 1.0.6 has requirement python-dateutil==2.6.0, but you’ll have python-dateutil 2.7.3 which is incompatible.
upsmychoice 1.0.6 has requirement requests==2.12.4, but you’ll have requests 2.19.1 which is incompatible.
toonlib 1.0.2 has requirement cachetools==2.0.0, but you’ll have cachetools 2.0.1 which is incompatible.
toonlib 1.0.2 has requirement requests==2.13.0, but you’ll have requests 2.19.1 which is incompatible.
temperusb 1.5.3 has requirement pyusb>=1.0.0rc1, but you’ll have pyusb 1.0.0b1 which is incompatible.
spotcrime 1.0.3 has requirement requests==2.12.4, but you’ll have requests 2.19.1 which is incompatible.
skybellpy 0.1.2 has requirement colorlog==3.0.1, but you’ll have colorlog 3.1.4 which is incompatible.
python-velbus 2.0.11 has requirement pyserial==3.3, but you’ll have pyserial 3.1.1 which is incompatible.
python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you’ll have pycryptodome 3.6.4 which is incompatible.
pysma 0.2.0 has requirement aiohttp<3,>2, but you’ll have aiohttp 3.3.2 which is incompatible.
pysma 0.2.0 has requirement async-timeout<3,>2, but you’ll have async-timeout 3.0.0 which is incompatible.
pymysensors 0.16.0 has requirement pyserial>=3.4, but you’ll have pyserial 3.1.1 which is incompatible.
pymonoprice 0.3 has requirement pyserial>=3.4, but you’ll have pyserial 3.1.1 which is incompatible.
pymata 2.14 has requirement pyserial==2.7, but you’ll have pyserial 3.1.1 which is incompatible.
pyicloud 0.9.1 has requirement keyring<9.0,>=8.0, but you’ll have keyring 13.2.1 which is incompatible.
pyicloud 0.9.1 has requirement keyrings.alt<2.0,>=1.0, but you’ll have keyrings-alt 3.1 which is incompatible.
pyblackbird 0.5 has requirement pyserial>=3.4, but you’ll have pyserial 3.1.1 which is incompatible.
nad-receiver 0.0.9 has requirement pyserial==3.2.1, but you’ll have pyserial 3.1.1 which is incompatible.
myusps 1.3.2 has requirement python-dateutil==2.6.0, but you’ll have python-dateutil 2.7.3 which is incompatible.
myusps 1.3.2 has requirement requests==2.12.4, but you’ll have requests 2.19.1 which is incompatible.
myusps 1.3.2 has requirement selenium==2.53.6, but you’ll have selenium 3.14.0 which is incompatible.
mycroftapi 2.0 has requirement websocket-client==0.44.0, but you’ll have websocket-client 0.37.0 which is incompatible.
motorparts 1.0.2 has requirement beautifulsoup4==4.5.1, but you’ll have beautifulsoup4 4.6.0 which is incompatible.
motorparts 1.0.2 has requirement requests==2.12.4, but you’ll have requests 2.19.1 which is incompatible.
magicseaweed 1.0.0 has requirement requests==2.12.4, but you’ll have requests 2.19.1 which is incompatible.
locationsharinglib 2.0.7 has requirement requests==2.18.4, but you’ll have requests 2.19.1 which is incompatible.
libsoundtouch 0.7.2 has requirement websocket-client>=0.40.0, but you’ll have websocket-client 0.37.0 which is incompatible.
insteonplm 0.11.7 has requirement pyserial==3.2.0, but you’ll have pyserial 3.1.1 which is incompatible.
hipnotify 1.0.8 has requirement requests==2.9.1, but you’ll have requests 2.19.1 which is incompatible.
fedexdeliverymanager 1.0.6 has requirement beautifulsoup4==4.5.1, but you’ll have beautifulsoup4 4.6.0 which is incompatible.
fedexdeliverymanager 1.0.6 has requirement python-dateutil==2.6.0, but you’ll have python-dateutil 2.7.3 which is incompatible.
discord-py 0.16.12 has requirement aiohttp<1.1.0,>=1.0.0, but you’ll have aiohttp 3.3.2 which is incompatible.
crimereports 1.0.0 has requirement requests==2.12.4, but you’ll have requests 2.19.1 which is incompatible.
broadlink 0.9 has requirement pycryptodome==3.4.11, but you’ll have pycryptodome 3.6.4 which is incompatible.
alarmdecoder 1.13.2 has requirement pyserial==2.7, but you’ll have pyserial 3.1.1 which is incompatible.
abodepy 0.13.1 has requirement colorlog==3.0.1, but you’ll have colorlog 3.1.4 which is incompatible.
Command “/usr/local/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-install-4t7j0pxo/lxml/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-85djwgjd/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-install-4t7j0pxo/lxml/
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
2018-08-06 11:00:33 ERROR (MainThread) [homeassistant.requirements] Not initializing media_player.alexa because could not install requirement lxml==4.2.3

1 Like

I dont get a captcha image shown, but that:

If I open the picture URL (https://opfcaptcha-prod.s3.amazonaws.com/41351ca8b6054eebb42ecb38d14aee1a.jpg?AWSAccessKeyId=xxxx&Expires=1533547693&Signature=DvB65cgV%2BHJCbzOoD9H4wqSeSwA%3D) , I get:

<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
<Expires>2018-08-06T09:28:13Z</Expires>
<ServerTime>2018-08-06T09:28:58Z</ServerTime>
<RequestId>4DBFCD7947F2FBD0</RequestId>
<HostId>
yyyyy
</HostId>
</Error>

But after entering an empty string and a retry, I go a valid captcha and :slight_smile:

!!! My devices got discoverd Yeah !!!

Many Thanks Great work!!!

Regards

For me the same!
alexa.py: 0.8.0
HassOS: 1.9
Hass.io: 0.75.1

Similar error installing lxml on 0.75.1

Unable to prepare setup for platform media_player.alexa: Could not install all requirements.

Unable to install package lxml==4.2.3: Failed building wheel for lxml
wirelesstagpy 0.3.0 has requirement colorlog==3.0.1, but you'll have colorlog 3.1.4 which is incompatible.
waterfurnace 0.4.0 has requirement websocket-client>=0.46, but you'll have websocket-client 0.37.0 which is incompatible.
upsmychoice 1.0.6 has requirement beautifulsoup4==4.5.1, but you'll have beautifulsoup4 4.6.0 which is incompatible.
upsmychoice 1.0.6 has requirement python-dateutil==2.6.0, but you'll have python-dateutil 2.7.3 which is incompatible.
upsmychoice 1.0.6 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible.
toonlib 1.0.2 has requirement cachetools==2.0.0, but you'll have cachetools 2.0.1 which is incompatible.
toonlib 1.0.2 has requirement requests==2.13.0, but you'll have requests 2.19.1 which is incompatible.
temperusb 1.5.3 has requirement pyusb>=1.0.0rc1, but you'll have pyusb 1.0.0b1 which is incompatible.
spotcrime 1.0.3 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible.
skybellpy 0.1.2 has requirement colorlog==3.0.1, but you'll have colorlog 3.1.4 which is incompatible.
python-velbus 2.0.11 has requirement pyserial==3.3, but you'll have pyserial 3.1.1 which is incompatible.
python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you'll have pycryptodome 3.6.4 which is incompatible.
pysma 0.2.0 has requirement aiohttp<3,>2, but you'll have aiohttp 3.3.2 which is incompatible.
pysma 0.2.0 has requirement async-timeout<3,>2, but you'll have async-timeout 3.0.0 which is incompatible.
pymysensors 0.16.0 has requirement pyserial>=3.4, but you'll have pyserial 3.1.1 which is incompatible.
pymonoprice 0.3 has requirement pyserial>=3.4, but you'll have pyserial 3.1.1 which is incompatible.
pymata 2.14 has requirement pyserial==2.7, but you'll have pyserial 3.1.1 which is incompatible.
pyicloud 0.9.1 has requirement keyring<9.0,>=8.0, but you'll have keyring 13.2.1 which is incompatible.
pyicloud 0.9.1 has requirement keyrings.alt<2.0,>=1.0, but you'll have keyrings-alt 3.1 which is incompatible.
pyblackbird 0.5 has requirement pyserial>=3.4, but you'll have pyserial 3.1.1 which is incompatible.
nad-receiver 0.0.9 has requirement pyserial==3.2.1, but you'll have pyserial 3.1.1 which is incompatible.
myusps 1.3.2 has requirement python-dateutil==2.6.0, but you'll have python-dateutil 2.7.3 which is incompatible.
myusps 1.3.2 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible.
myusps 1.3.2 has requirement selenium==2.53.6, but you'll have selenium 3.14.0 which is incompatible.
mycroftapi 2.0 has requirement websocket-client==0.44.0, but you'll have websocket-client 0.37.0 which is incompatible.
motorparts 1.0.2 has requirement beautifulsoup4==4.5.1, but you'll have beautifulsoup4 4.6.0 which is incompatible.
motorparts 1.0.2 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible.
magicseaweed 1.0.0 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible.
locationsharinglib 2.0.7 has requirement requests==2.18.4, but you'll have requests 2.19.1 which is incompatible.
libsoundtouch 0.7.2 has requirement websocket-client>=0.40.0, but you'll have websocket-client 0.37.0 which is incompatible.
insteonplm 0.11.7 has requirement pyserial==3.2.0, but you'll have pyserial 3.1.1 which is incompatible.
hipnotify 1.0.8 has requirement requests==2.9.1, but you'll have requests 2.19.1 which is incompatible.
fedexdeliverymanager 1.0.6 has requirement beautifulsoup4==4.5.1, but you'll have beautifulsoup4 4.6.0 which is incompatible.
fedexdeliverymanager 1.0.6 has requirement python-dateutil==2.6.0, but you'll have python-dateutil 2.7.3 which is incompatible.
discord-py 0.16.12 has requirement aiohttp<1.1.0,>=1.0.0, but you'll have aiohttp 3.3.2 which is incompatible.
crimereports 1.0.0 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible.
broadlink 0.9 has requirement pycryptodome==3.4.11, but you'll have pycryptodome 3.6.4 which is incompatible.
alarmdecoder 1.13.2 has requirement pyserial==2.7, but you'll have pyserial 3.1.1 which is incompatible.
abodepy 0.13.1 has requirement colorlog==3.0.1, but you'll have colorlog 3.1.4 which is incompatible.
Command "/usr/local/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-0t_awi8w/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-40crqjjc/install-record.txt --single-version-externally-managed --prefix  --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-0t_awi8w/lxml/
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
1 Like

Are you sure that it isn’t working? Like I mention in the post, the add-on still shows in the HA panel, but the functionality is removed. The custom component only solution works thereafter, without the two fighting with each other.

Hi all,
0.80 is working successfully for me.
Have restarted a couple of times without having any issues (no more re-enter captcha!!).
I’m running Hass 0.75.1 on Ubuntu 16.0.4 in a virtual environment.

I will add that the first time running 0.8, the following shows up in the log:

Error loading pickled cookie to <ha_config_dir>/alexa_media.pickle: An exception of type FileNotFoundError occurred. Arguments: (2, ‘No such file or directory’)
10:17 AM custom_components/media_player/alexa.py (ERROR)

But this was not an issue for me. It created the alexa_media.pickle file anyway.
Subsequent restarts no longer generated this log event.

Thanks for this!!

I have got is working on a docker image fine, but my HASSOS 7.51 is still not working.

I even tried coping the cache file from the working docker image.

Getting this message:

The following components and platforms could not be set up:

media_player.alexa
Please check your config.

Excellent update…works beautifully.