8000 Myq down again · Issue #36643 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Myq down again #36643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nikiyao opened this issue Jun 10, 2020 · 47 comments · Fixed by #36666
Closed

Myq down again #36643

nikiyao opened this issue Jun 10, 2020 · 47 comments · Fixed by #36666
Assignees

Comments

@nikiyao
Copy link
nikiyao commented Jun 10, 2020

The problem

MyQ shows unavailable again, cannot setup integration

Environment
• Home Assistant Core release with the issue: 0.111.0
• Last working Home Assistant Core release (if known): 0.111.0
• Operating environment (Home Assistant/Supervised/Docker/venv): HA
• Integration causing this issue: MyQ
• Link to integration documentation on our website:

Problem-relevant configuration.yaml

Config FLow

Traceback/Error logs

Log Details (ERROR)

Logger: homeassistant.config_entries
Source: components/myq/__init__.py:36
First occurred: 6:17:24 PM (1 occurrences)
Last logged: 6:17:24 PM

Error setting up entry  for myqTraceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 217, in async_setup hass, self File "/usr/src/homeassistant/homeassistant/components/myq/__init__.py", line 36, in async_setup_entry myq = await pymyq.login(conf[CONF_USERNAME], conf[CONF_PASSWORD], websession) File "/usr/local/lib/python3.7/site-packages/pymyq/api.py", line 172, in login await api.authenticate(username, password) File "/usr/local/lib/python3.7/site-packages/pymyq/api.py", line 121, in authenticate self._security_token = auth_resp["SecurityToken"] TypeError: 'NoneType' object is not subscriptable

@dshokouhi
Copy link
Member

@nikiyao please make sure to fill out the issue template that gets presented when you create a new issue. Also you may want to update your error message and remove identifiable information too.

@probot-home-assistant
Copy link

myq documentation
myq source
(message by IssueLinks)

@nikiyao
Copy link
Author
nikiyao commented Jun 10, 2020

Hmm I didn't see an issue template this time although I have seen it before

@dshokouhi
Copy link
Member

Are you on HA 0.110.5 and later too? because this exact error was fixed there.

#36466

@nikiyao
Copy link
Author
nikiyao commented Jun 10, 2020

@dshokouhi I'm on 0.111.0 this just started within the past hour though

@nikiyao
Copy link
Author
nikiyao commented Jun 10, 2020

@dshokouhi did my best to copy the template from elsewhere

@probot-home-assistant
Copy link

Hey there @bdraco, mind taking a look at this issue as its been labeled with a integration (myq) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@Kanga-Who
Copy link
Kanga-Who commented Jun 10, 2020

Same issue, updated to 0.111.0. Was working with 0.110.5.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/myq/config_flow.py", line 50, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/usr/src/homeassistant/homeassistant/components/myq/config_flow.py", line 30, in validate_input
    await pymyq.login(data[CONF_USERNAME], data[CONF_PASSWORD], websession)
  File "/usr/local/lib/python3.7/site-packages/pymyq/api.py", line 172, in login
    await api.authenticate(username, password)
  File "/usr/local/lib/python3.7/site-packages/pymyq/api.py", line 121, in authenticate
    self._security_token = auth_resp["SecurityToken"]
TypeError: 'NoneType' object is not subscriptable

@Anon0ne
Copy link
Anon0ne commented Jun 10, 2020

I literally applied this fix several hours ago, only for it to break again during a reset a few moments ago.

@broyuken
Copy link
broyuken commented Jun 10, 2020

Same, updated to 0.111.0 and it broke again. Worked earlier today but broke within the last few hours.

@breakthestatic
Copy link
breakthestatic commented Jun 10, 2020

It seems that the User-Agent header is messing with the response. When I replicate the pymyq call manually it works with User-Agent omitted, but throws a connection reset error with it added.

Works manually:

curl --location --request POST 'https://api.myqdevice.com/api/v5/Login' \
--header 'Content-Type: application/json' \
--header 'MyQApplicationId: JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu' \
--data-raw '{
    "Username": "username",
    "Password": "password"
}'

Throws SSL error (curl: (56) OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 104):

curl --location --request POST 'https://api.myqdevice.com/api/v5/Login' \
--header 'Content-Type: application/json' \
--header 'MyQApplicationId: JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu' \
--header 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' \
--data-raw '{
    "Username": "username",
    "Password": "password"
}'

I tried reverting the User-Agent line in api.js directly in my docker container but it is still failing. Not sure what else could be different between the curl and the aiohttp request.

EDIT:
It actually seems like the specific User-Agent set as the default is causing the problem. I just updated DEFAULT_USER_AGENT to a random one I found for a Galaxy S9:

Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36

And it's working again in HA as well.

@iantrich
Copy link
Member

Was the fix cherry picked for 0.110.5 and not added to 0.111.0?

@dshokouhi
Copy link
Member

@n8vision
Copy link

+1 - fresh install, worked 4 hours ago, just stopped working.

@ninjazx06
Copy link
ninjazx06 commented Jun 11, 2020

0.110.5 stopped working
0.111.0 doesn't work
0.111.0b2:
2020-06-10 21:12:31 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry <user id> for myq
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 217, in async_setup
hass, self
File "/usr/src/homeassistant/homeassistant/components/myq/init.py", line 36, in async_setup_entry
myq = await pymyq.login(conf[CONF_USERNAME], conf[CONF_PASSWORD], websession)
File "/usr/local/lib/python3.7/site-packages/pymyq/api.py", line 172, in login
await api.authenticate(username, password)
File "/usr/local/lib/python3.7/site-packages/pymyq/api.py", line 121, in authenticate
self._security_token = auth_resp["SecurityToken"]
TypeError: 'NoneType' object is not subscriptable
2020-06-10 21:12:31 ERROR (MainThread) [homeassistant.util.logging] Exception in async_set_cast_info called from
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/src/homeassistant/homeassistant/main.py", line 364, in
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 356, in main
exit_code = asyncio.run(setup_and_run_hass(config_dir, args), debug=args.debug)
File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 574, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 541, in run_forever
self._run_once()
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1786, in _run_once
handle._run()
File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 441, in _async_add_entity
await entity.async_added_to_hass()
File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 219, in async_added_to_hass
async_create_catching_coro(self.async_set_cast_info(self._cast_info))

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 282, in async_set_cast_info
cast_info.friendly_name,
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/pychromecast/init.py", line 86, in get_chromecast_from_service
zconf=zconf,
File "/usr/local/lib/python3.7/site-packages/pychromecast/init.py", line 260, in init
dev_status = get_device_status(self.host, services, zconf)
File "/usr/local/lib/python3.7/site-packages/pychromecast/dial.py", line 75, in get_device_status
status = _get_status(host, services, zconf, "/setup/eureka_info?options=detail")
File "/usr/local/lib/python3.7/site-packages/pychromecast/dial.py", line 43, in _get_status
host, _ = get_host_from_service_info(service_info)
File "/usr/local/lib/python3.7/site-packages/pychromecast/discovery.py", line 186, in get_host_from_service_info
if service_info.address:
AttributeError: 'ServiceInfo' object has no attribute 'address'

@ssilence5
Copy link
ssilence5 commented Jun 11, 2020

I can confirm that the following user-agent that I found on a Homebridge MyQ plugin also works.

DEFAULT_USER_AGENT = "myQ/14041 CFNetwork/1107.1 Darwin/19.0.0"

Might be useful to include this as part of the configuration. Can we have an override in the configuration for user-agent. Maybe something like this (YAML):

---
#
# https://www.home-assistant.io/integrations/myq/
#
platform: myq
username: !secret myq_username 
password: !secret myq_password
type: chamberlain
user_agent: 'myQ/14041 CFNetwork/1107.1 Darwin/19.0.0'

@broyuken
Copy link

Was the fix cherry picked for 0.110.5 and not added to 0.111.0?

No it’s there, I think myq broke us again.

@Kanga-Who
Copy link

Which file needs to be edited to fix?

I've gone into..

sudo docker exec -t -i homeassistant /bin/bash
and then
cd /usr/src/homeassistant/homeassistant/components/myq

I've had a look in init.py but can't find the DEFAULT_USER_AGENT = "myQ/14041 CFNetwork/1107.1 Darwin/19.0.0" line to edit.

@yetdog
Copy link
yetdog commented Jun 11, 2020

Which file needs to be edited to fix?

I've gone into..

sudo docker exec -t -i homeassistant /bin/bash
and then
cd /usr/src/homeassistant/homeassistant/components/myq

I've had a look in init.py but can't find the DEFAULT_USER_AGENT = "myQ/14041 CFNetwork/1107.1 Darwin/19.0.0" line to edit.

api.py

@Kanga-Who
Copy link
Kanga-Who commented Jun 11, 2020

api.py

I don't seem to have that file

__init__.py binary_sensor.py const.py manifest.json translations
__pycache__ config_flow.py cover.py strings.json

edit: I removed the integration to re-install to try and fix, would that be why?

@ninjazx06
Copy link

@Kanga-Who I have the same content you listed. No api.py

8000

@CAB426
Copy link
CAB426 commented Jun 11, 2020

Need to look here:
/usr/local/lib/python3.7/site-packages/pymyq/api.py

@Kanga-Who
Copy link
Kanga-Who commented Jun 11, 2020

Need to look here:
/usr/local/lib/python3.7/site-packages/pymyq/api.py

Perfect. Can confirm the fix.

DEFAULT_USER_AGENT = "myQ/14041 CFNetwork/1107.1 Darwin/19.0.0"

@juched78
Copy link

Fix worked for me as well on 111.0. Hope this isn’t a new cat and mouse game.

@kandrews2006
Copy link
67E6

Just upgraded to 111.0 from 110.5 and this fix is working for me as well.

@mattsch
Copy link
Contributor
mattsch commented Jun 11, 2020

Fix is working on 0.110.7 as well.

@hobybrenner
Copy link

Worked for me on 111.0 too. Thanks.

@devinslick
Copy link

Anyone working on a pull request for this issue?
It seems like updating the DEFAULT_USER_AGENT and making it configurable would be best.
I can take a stab at it if no one else is on it already.

@nikiyao
Copy link
Author
nikiyao commented Jun 11, 2020

Would anyone mind doing a step by step breakdown of how to apply this fix?

@devinslick
Copy link

@nikiyao :
docker exec -ti hass /bin/sh
(replace hass with your container name)

cd /usr/local/lib/python3.7/site-packages/pymyq
vi api.py
scroll down until you find the DEFAULT_USER_AGENT line
Press INSERT
Delete that line or comment it out with a #
Press ENTER to add a new line
Press SHIFT + INSERT to paste this in its place:
DEFAULT_USER_AGENT = "myQ/14041 CFNetwork/1107.1 Darwin/19.0.0"

image

image

@bdraco
Copy link
Member
bdraco commented Jun 11, 2020

PR is here

arraylabs/pymyq#42

@bdraco bdraco linked a pull request Jun 11, 2020 that will close this issue
20 tasks
@FutureTense
Copy link

Does anyone have reason to believe MyQ is intentionally targeting HomeAssistant with this user-agent issue?

@dshokouhi
Copy link
Member

Does anyone have reason to believe MyQ is intentionally targeting HomeAssistant with this user-agent issue?

This integration uses an undocumented and unsupported API so constantly breaking should be expected.

https://github.com/arraylabs/pymyq#disclaimer

@broyuken
Copy link

They’re very stingy with their API. Does anyone know of any custom firmware or hacks to remove the cloud completely? Short of adding a relay in between the button and opener and adding a tilt sensor. Any way to spoof the chamberlain servers to control locally, etc.

@bkvargyas
Copy link

I believe they are trying to break integrations not using their approved integrations. They have always used a pay to play model, even with IFTTT, which I think is the wrong approach in today's age of IoT. I get it that there are expenses in running a cloud infrastructure, and a garage door opener is a one time purchase. Trying to reverse engineer the door opener to try and get it to connect to your system directly won't scale. I'm just down the street from their corporate office in Oakbrook -- One of these days I may stop in and see if I can talk to someone in software/business development and maybe some good may come out of it. We'll see....

@uggb123
Copy link
uggb123 commented Jun 12, 2020

@nikiyao :
docker exec -ti hass /bin/sh
(replace hass with your container name)

cd /usr/local/lib/python3.7/site-packages/pymyq
vi api.py
scroll down until you find the DEFAULT_USER_AGENT line
Press INSERT
Delete that line or comment it out with a #
Press ENTER to add a new line
Press SHIFT + INSERT to paste this in its place:
DEFAULT_USER_AGENT = "myQ/14041 CFNetwork/1107.1 Darwin/19.0.0"

image

image

Thanks to devinslick for posting the exact commands for the newbie's like me. I made the change as described step-by-step to api.py. One question, once the change is made to the file, what command do I need to use to save the edits and close the file back to the command prompt? I tried CTRL-V but my HA instance would no longer boot up so I am starting over with the program from scratch - not a huge loss, I am still experimenting with the program. Thanks, Glenn

@kenstone
Copy link

@nikiyao :
docker exec -ti hass /bin/sh
(replace hass with your container name)
cd /usr/local/lib/python3.7/site-packages/pymyq
vi api.py
scroll down until you find the DEFAULT_USER_AGENT line
Press INSERT
Delete that line or comment it out with a #
Press ENTER to add a new line
Press SHIFT + INSERT to paste this in its place:
DEFAULT_USER_AGENT = "myQ/14041 CFNetwork/1107.1 Darwin/19.0.0"
image
image

Thanks to devinslick for posting the exact commands for the newbie's like me. I made the change as described step-by-step to api.py. One question, once the change is made to the file, what command do I need to use to save the edits and close the file back to the command prompt? I tried CTRL-V but my HA instance would no longer boot up so I am starting over with the program from scratch - not a huge loss, I am still experimenting with the program. Thanks, Glenn

Hit Escape. Then colon, then w, then q

@ifixrjs
Copy link
ifixrjs commented Jun 12, 2020

I cannot install the package because of the aforementioned error. Pymyq is not located in /usr/local/lib/python3.7/site-packages/ because I can't install. The fix above seems to be there for people who had previous successful install. Any suggestions for those of us who cannot install it?

@devinslick
Copy link

@ifixrjs , Are you on 0.111.1?

@Kanga-Who
Copy link

The fix is in 0.111.1, update and problem solved.

@ifixrjs
Copy link
ifixrjs commented Jun 12, 2020

Yes I am on 0.111.0.
0.111.1 did indeed fix it. Thanks for the swift reply.

@romaneleven11
Copy link

anyone else having this issue again..in 0.111.4?

@uggb123
Copy link
uggb123 commented Jun 26, 2020

I am. I haven't confirmed whether the code is the problem again but my garage doors appear 'unavailable' in the overview screen meaning they are greyed out. The myq app works so I know it isn't a problem with the doors. Very frustrating.

@devinslick
Copy link

anyone else having this issue again..in 0.111.4?

@romaneleven11 yes. It’s a new issue and should be fixed by 0.112.0

#37104

@Kanga-Who
Copy link

anyone else having this issue again..in 0.111.4?

Yes, offline again today with 0.111.4. API must have changed again.

@bdraco
Copy link
Member
bdraco commented Jun 26, 2020

PR to fix it is linked here #37100

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0