alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.45k stars 279 forks source link

Setup of component fails with version 1.2.5 #213

Closed lweberru closed 5 years ago

lweberru commented 5 years ago

Hi,

I updated home assistant to newest version 0.94.3 and therefor I had to start over with my working alexa_media integration, because the deps folder got cleaned. Now I get the following error:

2019-06-17 16:53:49 ERROR (MainThread) [homeassistant.setup] Error during setup of component alexa_media
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 156, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/alexa_media/__init__.py", line 103, in setup
    account.get(CONF_DEBUG))
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexalogin.py", line 46, in __init__
    self.login_with_cookie()
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexalogin.py", line 83, in login_with_cookie
    self.login(cookies=cookies)
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexalogin.py", line 238, in login
    self._data = self.get_inputs(soup)
  File "/usr/local/lib/python3.7/site-packages/alexapy/alexalogin.py", line 110, in get_inputs
    for field in form.find_all('input'):
AttributeError: 'NoneType' object has no attribute 'find_all'

My config looks like this:

alexa_media:
  accounts:
    - email: !secret amazon_username
      password: !secret amazon_password
      url: amazon.de
      include_devices:
        - echo_bad
        - echo_dot_timo
        - echo_wohnzimmer
        - haus

Regards Lukas

alandtse commented 5 years ago

The log appears truncated as it isn't actually stating the cause of the error. However, based off where it's going, it looks like it may be missing the beautifulsoup dependency. If you're in hassio, it sometimes takes 2-3 restarts for hassio to properly download all the dependencies for some reason.

lweberru commented 5 years ago

I added the one missing line (AttributeError)

lweberru commented 5 years ago

How can I check if beautifulsoup is installed?

lweberru commented 5 years ago

I restarted 2 more times but the error still exists. I logged into home assistant container and checked the python directory (/usr/local/lib/python3.7)

bash-4.4# find . -name "*beautifulsoup*"
./site-packages/beautifulsoup4-4.7.1.dist-info
bash-4.4# pip3 list|grep -i soup
beautifulsoup4                   4.7.1
MechanicalSoup                   0.6.0
soupsieve                        1.9.1
bash-4.4# pip3 show beautifulsoup4
Name: beautifulsoup4
Version: 4.7.1
Summary: Screen-scraping library
Home-page: http://www.crummy.com/software/BeautifulSoup/bs4/
Author: Leonard Richardson
Author-email: leonardr@segfault.org
License: MIT
Location: /usr/local/lib/python3.7/site-packages
Requires: soupsieve
Required-by: xfinity-gateway, wikipedia, upsmychoice, srpenergy, schiene, pyialarm, pygtt, pydukeenergy, prezzibenzina-py, myusps, motorparts, meteofrance, MechanicalSoup, locationsharinglib, geizhals, gearbest-parser, fedexdeliverymanager, enocean, dlipower, bs4, AlexaPy
bash-4.4# ls /usr/local/lib/python3.7/site-packages/beautifulsoup4-4.7.1.dist-info/
AUTHORS        COPYING.txt    INSTALLER      LICENSE        METADATA       RECORD         WHEEL          top_level.txt
bash-4.4#

So I am unsure if it is installed correctly or not.

lweberru commented 5 years ago

If you check this, there could be a version conflict:

bash-4.4# pip3 check alexapy
xknx 0.10.0 has requirement pyyaml>=4.2b4, but you have pyyaml 3.13.
wirelesstagpy 0.4.0 has requirement colorlog==3.0.1, but you have colorlog 4.0.2.
upsmychoice 1.0.6 has requirement beautifulsoup4==4.5.1, but you have beautifulsoup4 4.7.1.
upsmychoice 1.0.6 has requirement python-dateutil==2.6.0, but you have python-dateutil 2.8.0.
upsmychoice 1.0.6 has requirement requests==2.12.4, but you have requests 2.22.0.
toonapilib 3.2.2 has requirement cachetools~=3.1.0, but you have cachetools 2.0.1.
toonapilib 3.2.2 has requirement requests~=2.21.0, but you have requests 2.22.0.
temperusb 1.5.3 has requirement pyusb>=1.0.0rc1, but you have pyusb 1.0.0b1.
skybellpy 0.4.0 has requirement colorlog==3.0.1, but you have colorlog 4.0.2.
python-velbus 2.0.24 has requirement pyserial==3.3, but you have pyserial 3.1.1.
python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you have pycryptodome 3.8.2.
pystiebeleltron 0.0.1.dev2 has requirement pymodbus>=2.1.0, but you have pymodbus 1.5.2.
pyrebase4 4.3.0 has requirement oauth2client==4.1.2, but you have oauth2client 4.0.0.
pymysensors 0.18.0 has requirement pyserial>=3.4, but you have pyserial 3.1.1.
pymonoprice 0.3 has requirement pyserial>=3.4, but you have pyserial 3.1.1.
pymata 2.14 has requirement pyserial==2.7, but you have pyserial 3.1.1.
pyicloud 0.9.1 has requirement click<7.0,>=6.0, but you have click 7.0.
pyicloud 0.9.1 has requirement keyring<9.0,>=8.0, but you have keyring 17.1.1.
pyicloud 0.9.1 has requirement keyrings.alt<2.0,>=1.0, but you have keyrings-alt 3.1.1.
pyblackbird 0.5 has requirement pyserial>=3.4, but you have pyserial 3.1.1.
openwrt-luci-rpc 1.0.5 has requirement requests==2.21.0, but you have requests 2.22.0.
nad-receiver 0.0.11 has requirement pyserial==3.2.1, but you have pyserial 3.1.1.
myusps 1.3.2 has requirement beautifulsoup4==4.6.0, but you have beautifulsoup4 4.7.1.
myusps 1.3.2 has requirement python-dateutil==2.6.0, but you have python-dateutil 2.8.0.
myusps 1.3.2 has requirement requests==2.12.4, but you have requests 2.22.0.
myusps 1.3.2 has requirement requests-cache==0.4.13, but you have requests-cache 0.5.0.
mycroftapi 2.0 has requirement websocket-client==0.44.0, but you have websocket-client 0.54.0.
motorparts 1.1.0 has requirement beautifulsoup4==4.5.1, but you have beautifulsoup4 4.7.1.
locationsharinglib 3.0.11 has requirement beautifulsoup4~=4.6.3, but you have beautifulsoup4 4.7.1.
locationsharinglib 3.0.11 has requirement requests~=2.21.0, but you have requests 2.22.0.
insteonplm 0.15.4 has requirement pyserial==3.2.0, but you have pyserial 3.1.1.
ibm-watson 3.0.3 has requirement websocket-client==0.48.0, but you have websocket-client 0.54.0.
hipnotify 1.0.8 has requirement requests==2.9.1, but you have requests 2.22.0.
gearbest-parser 1.0.7 has requirement beautifulsoup4==4.6.0, but you have beautifulsoup4 4.7.1.
fedexdeliverymanager 1.0.6 has requirement beautifulsoup4==4.5.1, but you have beautifulsoup4 4.7.1.
fedexdeliverymanager 1.0.6 has requirement python-dateutil==2.6.0, but you have python-dateutil 2.8.0.
eebrightbox 0.0.4 has requirement certifi==2018.11.29, but you have certifi 2019.3.9.
eebrightbox 0.0.4 has requirement requests==2.21.0, but you have requests 2.22.0.
eebrightbox 0.0.4 has requirement urllib3==1.24.1, but you have urllib3 1.25.3.
broadlink 0.10 has requirement pycryptodome==3.6.6, but you have pycryptodome 3.8.2.
botocore 1.12.91 has requirement urllib3<1.25,>=1.20; python_version >= "3.4", but you have urllib3 1.25.3.
blinkpy 0.14.0 has requirement python-dateutil==2.7.5, but you have python-dateutil 2.8.0.
alexapy 0.5.0 has requirement websocket-client>=0.55.0, but you have websocket-client 0.54.0.
alarmdecoder 1.13.2 has requirement pyserial==2.7, but you have pyserial 3.1.1.
abodepy 0.15.0 has requirement colorlog==3.0.1, but you have colorlog 4.0.2.
alandtse commented 5 years ago

You're not using a virtual environment? You do have beautifulsoup so I don't think it's that. Please try deleting your old .pickle file so it tries to rebuild the login.

If that doesn't work, we'll need to do the advanced debugging from the wiki where we see the login page you're failing at. The error is indicating we're not getting a webpage we can properly parse for login info.

lweberru commented 5 years ago

Hi attached you find the file alexa_mediaget.html which got writting during start. alexa_media.txt If I open that page in a browser something like an account switcher is displayed in an endless loop. I have not yet deleted the pickle file.

Regards

alandtse commented 5 years ago

Try renaming the .pickle files to see if that solves it for you. You can always rename them back.

lweberru commented 5 years ago

I had to reset the amazon password. Now it is back working. No clue what happened. Thx for support!