home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.87k stars 28.97k forks source link

MyQ still not working after upgrade to 0.100.3 #28172

Closed skug67 closed 4 years ago

skug67 commented 4 years ago

HomeAssistant 0.100.3 running in virtualenv/python3.7/debian

Following error when trying to contact myq:

2019-10-24 08:09:36 ERROR (MainThread) [homeassistant.components.cover] Error while setting up platform myq
Traceback (most recent call last):
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homeassistant/components/myq/cover.py", line 53, in async_setup_platform
    myq = await login(username, password, websession)
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/pymyq/api.py", line 162, in login
    await api.authenticate(username, password)
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/pymyq/api.py", line 117, in authenticate
    login_request=True,
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/pymyq/api.py", line 85, in request
    data = await resp.json(content_type=None)
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 1040, in json
    return loads(stripped.decode(encoding))
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
bachya commented 4 years ago

I've been running the new MyQ for several days and haven't seen this. Are you seeing it consistently?

skug67 commented 4 years ago

I do get it consistently. I've even tried directly running the sample script (for get all devices) from https://github.com/arraylabs/pymyq as a check (within the virtualenv where homeassistant is running) and that throws the same errors as well.....

bachya commented 4 years ago

Thanks for the info, @skug67. Let's do some debugging.

Open up a terminal and do the following:

$ curl -X "POST" "https://api.myqdevice.com/api/v5/Login" \
     -H 'Content-Type: application/json' \
     -H 'User-Agent: Chamberlain/10482 CFNetwork/978.0.7 Darwin/18.6.0' \
     -H 'MyQApplicationId: JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu' \
     -d $'{
  "username": "<YOUR USERNAME/EMAIL>",
  "password": "<YOUR PASSWORD>"
}'

This should return a JSON response with a security token. Don't post that token here – rather, copy it into another cURL request:

$ curl "https://api.myqdevice.com/api/v5/My?expand=account" \
     -H 'Content-Type: application/json' \
     -H 'User-Agent: Chamberlain/10482 CFNetwork/978.0.7 Darwin/18.6.0' \
     -H 'MyQApplicationId: JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu' \
     -H 'SecurityToken: <YOUR SECURITY TOKEN>'

This should return a JSON response with your account info. Find your account ID (Account -> Id) and use that (along with the security token) in one final cURL request:

$ curl "https://api.myqdevice.com/api/v5/Accounts/<YOUR ACCOUNT ID>" \
     -H 'Content-Type: application/json' \
     -H 'User-Agent: Chamberlain/10482 CFNetwork/978.0.7 Darwin/18.6.0' \
     -H 'MyQApplicationId: JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu' \
     -H 'SecurityToken: <YOUR SECURITY TOKEN>' \

Do any of these requests return something other than JSON (which is what your error seems to indicate)?

skug67 commented 4 years ago

OK. So this is really weird. When I run that on the machine that's got homeassistant on it (which is at a remote location and I'm accessing via ssh over a VPN) I get the following:

Request RejectedThe requested URL was rejected. Please consult with your administrator.

Your support ID is: 16366184269778173399

[Go Back]

On the other hand, if I run it from a server at home it works just fine....

bachya commented 4 years ago

Fascinating. 😆 The only times I've seen that type of message is when an ad blocker/parental control thing/etc. blocks a request; any chance your HASS machine has something like that running?

skug67 commented 4 years ago

It sits behind a netgear orbi router. I've disabled parental controls, but I also seem to be unable to reach its web interface so I think there's something screwy going on there. I'll assume for now that's what's driving the wacky behavior.

Thanks for the guidance.

skug67 commented 4 years ago

Same problems are recurring. And I'm now getting the same error message from my local machine which I know is not behind any kind of urlblocker/parental control device (connected directly to the FIOS ONT w/o even a Verizon router).

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.