core: MyQ fails with 403 forbidden error after recent cloud changes

The problem

This is the first time the MyQ integration has given me any trouble, and it started shortly after I opened the garage door today. I closed it 30 minutes later, but Home Assistant never received that notification.

This is what I see repeating in the log:

2023-09-08 10:47:32.661 ERROR (MainThread) [homeassistant.components.myq] Error fetching myq devices data: Error requesting data from https://devices.myq-cloud.com/api/v5.2/Accounts/86f16316-3d74-4c7c-af7b-2d137be0693d/Devices: 403 - Forbidden

What version of Home Assistant Core has the issue?

core-2023.9.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

MyQ

Link to integration documentation on our website

https://www.home-assistant.io/integrations/myq/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 139
  • Comments: 518 (31 by maintainers)

Commits related to this issue

Most upvoted comments

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:
cd config
wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip
unzip useragent_fix.zip
mv pymyq-useragent_fix/pymyq .
rm -fr useragent_fix.zip pymyq-useragent_fix
  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant.

EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

Thanks @lygris, that did work.

  • docker exec -it homeassistant bash
  • cd /usr/local/lib/python3.11/site-packages/pymyq/
  • cp request.py request_bup.py
  • vi request.py
  • i to enter insert mode
  • Modify line 34
    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode
  • :w + enter to write the changes
  • :x + enter to exit VI
  • Restart Home Assistant

I think its safe to assume its down for everybody. Probably no need for everybody to chime in saying the same thing.

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:
cd config
wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip
unzip useragent_fix.zip
mv pymyq-useragent_fix/pymyq .
rm -fr useragent_fix.zip pymyq-useragent_fix
  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant. EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

This doesn’t work in the container. Any method that does?

This fixed my issue. Thanks

This worked for me also. Thank you so much!!!

Awesome job, did the trick and works for me. Thank you very much @michguy2000 !

This thread is for debugging the issue with 403 errors from MyQ. Please move discussion to the community forums or elsewhere.

Hi everyone, I want to reiterate what @pho3nixf1re said here.

GitHub issues are for debugging specific problems. This discussion has gotten way off topic. Please move this conversation to https://community.home-assistant.io or over to Discord. Those are the proper channels for discussing workarounds and unsupported modifications.

Furthermore, chiming in that these unsupported fixes worked or did not work for you blasts off an email notification to everyone working towards a solution, and just makes it more difficult to follow the solutioning conversation. Again, this sort of conversation is welcome on the forums, but if you are not directly contributing to solving the reported issue, I ask that you please refrain from commenting in issue threads and use the proper channels to engage in conversation.

It is extremely difficult for contributors, maintainers, and the core team to find relevant information when working on fixes to the originally reported problem with all of the noise. There are over 350 comments on this issue. This much off-topic chatter only delays fixes being implemented.

If it is deemed to be an upstream issue and no fix is required, that analysis will be done by the code owners and the issue will be updated accordingly. If a fix is required, the code owners will determine next steps.

If you are interested in keeping up with the status of this issue, please click the subscribe button on the right. There is no need to comment just to receive updates.

Please review the HA help guidelines for proper usage of the many communication channels offered.

https://www.home-assistant.io/help

When I started looking into it, I did not enjoy the dependency on a network connection. Instead I sidestepped that MyQ integration, and went instead with hardwiring a compatible remote control, to a Z-Wave controller. That gave me local control with no network dependency whatsoever. I also knew that the remote control would be completely compatible with the garage door. I used the Zooz multi controller, and set the individual switches to momentary with a certain time. It’s been working flawlessly for a few years. It also meant that the Home Assistant or Habitat controller would be able to stay completely local, which is part of embracing that solution and not a cloud dependency.

Same issue here…

Folks, again - please read this linked comment before commenting in this thread. We shouldn’t have to ask the core team to lock this thread because of poor issue etiquette.

https://github.com/home-assistant/core/issues/99947#issuecomment-1714727188

Why y’all acting like this isn’t a home assistant issue? If the above mentioned fix works, why not deploy it for everyone? It worked for me.

Just to pop over here to provide a quick hello and to confirm: this is not an API issue. This is a load balancer issue on the myQ server end in their Azure cloud…and will likely be resolved at some point in the near future, if not already.

A workaround can be to specify the specific myQ region you’d like to access the API from (east or west). That said, it too is hit-and-miss. In my own testing, the “user agent” fix isn’t really a fix…it’s correlation not causation, in my experience.

The awesome HA/myQ folks know me, but for the other - I maintain the myQ integration on the Homebridge end as well as an API library that folks can use in Node/JS.

HA team: if you want to specify region…take a look at the latest @hjdhjd/myq if it’s helpful and you can see how I’ve implemented it a couple of months ago when issues like this began. It’s important to note: “east” and “west” are geographies but it doesn’t mean that’s the one that you should use or will work for you, and nor is it an advisable long-term solution…you should really go through the load balancer as the “one true way”…but when you need to workaround it due to issues with their infrastructure, when they occur…it can be helpful.

Hope you guys are doing well…it’s been a fun few days. For what it’s worth…beyond Friday, I’ve noticed things being largely stable across the board with occasional hiccups.

For this wanting to read more of my commentary on this., or you can find me on the myQ channel on the Homebridge Discord. Cheers and let’s all get back to a nice boring “it just works” normal here any minute now…

You cannot put a link to an issue tracker like this one in the end UI and then expect users to understand what is noise and what isn’t. You have to direct them to provide the feedback you want by pointing them to the correct channels. If the correct channel is the forums, and not here, the link should not be to GitHub. If feedback on GitHub should be limited to developers in the organization, GitHub provides appropriate RBAC controls for setting those limitations if you have an Organization. You cannot expect users to follow a link to GitHub and then somehow find documentation saying that they should ask for help elsewhere. You also cannot expect end users to understand the difference between helpful and unhelpful feedback – most of them will not read the history in this thread and will think saying “me too” and maybe giving version info is helping, and that’s not their fault. They don’t know better and they cannot be expected to know better.

The onus of setting up appropriate permissions on threads like this is on the project maintainers. You can’t just repeatedly ask the thread to “STOP commenting and read random link to comment before commenting” because the people you’re trying to address won’t see those comments, or the linked ones, before they say “me too, version info”

Your appeals for appropriate usage of the thread add to the noise, they add to the problem. This isn’t a problem that can be solved with appeals, it’s a problem that has to be solved with role-based authorization for posting.

Now, I’m going to unsubscribe, because this thread doesn’t have the appropriate settings on it, and is therefore too noisy.

Ignore this advice all you want – I do have experience with open source projects, and if you want to deal with endless users saying me too and endlessly appealing to them to stop posting, be my guest. I’m just trying to help, even if it’s not information people want to hear.

Additional data point: After noticing the failure, I checked the MyQ app on my phone. It had no issue, and correctly showed that the garage door was closed.

Please stop making “following” posts. You can just thumb up the issue and hit the “subscribe” button on the top right section of the issue.

Folks, we have asked 5 times that this conversation be moved to the forums so the code owners can use this space to work the problem. Either yall aren’t reading these requests, or don’t care and choosing to not respecting the process and the people involved. Both are a problem.

Please 🛑STOP🛑 and read the linked comment before commenting.

If you’re new to the community conversation, we would love to have your input over on https://community.home-assistant.io/ - however, having this conversation in the GitHub issue and cluttering the space intended for active contributions to fixing the source code is bad issue etiquette.

Please use the proper channels as this is an enormous project with many people involved and many moving parts. The off topic comments make it exponentially more difficult for those responsible for fixing the issue to find relevant info.

https://github.com/home-assistant/core/issues/99947#issuecomment-1714727188

I am also having this issue, and also do not have issues with the MyQ app. That said, it feels like it is still something on Chamberlain’s side…a change or something that has impacted this integration. Nothing changed in my Home Assistant between the time this was working and the time it stopped.

Started working again after the z-wave.js update not sure why. It worked great for 2 days, then did the 2023.9.2 update last night and it broke again.

This thread is for debugging the issue with 403 errors from MyQ. Please move discussion to the community forums or elsewhere.

Hi everyone, I want to reiterate what @pho3nixf1re said here.

GitHub issues are for debugging specific problems. This discussion has gotten way off topic. Please move this conversation to https://community.home-assistant.io or over to Discord. Those are the proper channels for discussing workarounds and unsupported modifications.

Furthermore, chiming in that these unsupported fixes worked or did not work for you blasts off an email notification to everyone working towards a solution, and just makes it more difficult to follow the solutioning conversation. Again, this sort of conversation is welcome on the forums, but if you are not directly contributing to solving the reported issue, I ask that you please refrain from commenting in issue threads and use the proper channels to engage in conversation.

It is extremely difficult for contributors, maintainers, and the core team to find relevant information when working on fixes to the originally reported problem with all of the noise. There are over 350 comments on this issue. This much off-topic chatter only delays fixes being implemented.

If it is deemed to be an upstream issue and no fix is required, that analysis will be done by the code owners and the issue will be updated accordingly. If a fix is required, the code owners will determine next steps.

If you are interested in keeping up with the status of this issue, please click the subscribe button on the right. There is no need to comment just to receive updates.

Please review the HA help guidelines for proper usage of the many communication channels offered.

https://www.home-assistant.io/help

Considering they specifically blocked the home assistant user-agent, I would be hesitant to simply change the UA and continue along. The most likely reason for them to block HA is because it’s making too many requests and creating too much load for them.

Looking at the component, it looks like it refreshes device info every 15 seconds with pymyp’s update_device_info. That function then actually makes multiple API calls, first to list accounts, and then lists devices on each account.

This could easily be improved to cut the number of API requests in half by caching the account info, which it looks like pymyp already does. Something like this should work:

if len(myq.accounts) == 0:
  await myq.update_device_info()
else:
  for account in myq.accounts:
    await myq.accounts[account].update()

Same error 403. Failed setup, trying to initialize.

This DOES work… Install the Advanced SSH & Web Terminal add-on In the terminal add-on, run the following commands:

cd config wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip unzip useragent_fix.zip mv pymyq-useragent_fix/pymyq . rm -fr useragent_fix.zip pymyq-useragent_fix Restart Home Assistant

Following. Broken in 9.2

FOR THE LOVE OF… Stop contacting MyQ and alerting them to the presence of this unofficial use of their API! 🤦

i just installed myQ today with a brand new liftmaster, I am getting error trying to add to the HA integration - Error requesting data from https://accounts.myq-cloud.com/api/v6.0/accounts: 403 - Forbidden; Retrying in background

Same error 403. Failed setup, trying to initialize.

This DOES work… Install the Advanced SSH & Web Terminal add-on In the terminal add-on, run the following commands:

cd config wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip unzip useragent_fix.zip mv pymyq-useragent_fix/pymyq . rm -fr useragent_fix.zip pymyq-useragent_fix Restart Home Assistant

This worked for me 🥳 running on v2023.9.2

i just installed myQ today with a brand new liftmaster, I am getting error trying to add to the HA integration - Error requesting data from https://accounts.myq-cloud.com/api/v6.0/accounts: 403 - Forbidden; Retrying in background

If you would read the other 380 posts in this thread, you would know why you are getting that, and a workaround was posted until the fix.

p.s. I understand the pain of engineers who are working on a fix, but you can’t expect end users not to use this thread while there is a direct link to github in the HA’s UI. It’s a good case to discuss with HA team. Maybe there needs to be another way to report bugs OR maybe the engineers should have a way to work on the issue separately from end users.

It’s not the reporting of the bug that’s the problem. It’s when people come up with unsupported workarounds and then the thread starts morphing from fixing the issue to hacking your install into submission.

And then posts like yours and many others that just say “it worked for me” or “it’s broken again” - if you are providing new information, sure you’re in the right place. But 300 people before you have said the same things over and over. You are the 7th person to say it suddenly started working again. If you aren’t providing conversation that will move the issue towards a fix, the forums are the place to go.

This is clearly documented. There is no discussion to be had. Just people who need to read https://home-assistant.io/help. The intent of GitHub issues is to be an issue tracker. You are not using it as such.

Edit: this will be my last comment. I’m tired of asking.

Please forgive if I posted my problem in the wrong place. Please tell me what to do differently when I have a problem with a particular HA integration.

Best regards, Robert Perkins

On Sep 15, 2023, at 10:03 AM, Mark Adkins @.***> wrote:

Folks, we have asked 5 times that this conversation be moved to the forums so the code owners can use this space to work the problem. Either yall aren’t reading these requests, or don’t care and choosing to not respecting the process and the people involved. Both are a problem.

Please 🛑STOP🛑 and read the linked comment before commenting.

If you’re new to the community conversation, we would love to have your input over on https://community.home-assistant.io/ - however, having this conversation in the GitHub issue and cluttering the space intended for active contributions to fixing the source code is bad issue etiquette.

Please use the proper channels as this is an enormous project with many people involved and many moving parts. The off topic comments make it exponentially more difficult for those responsible for fixing the issue to find relevant info.

#99947 (comment)https://github.com/home-assistant/core/issues/99947#issuecomment-1714727188

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/99947#issuecomment-1721335760, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH55NHZV42KVE3B2T2R4AX3X2RN2JANCNFSM6AAAAAA4QV5STU. You are receiving this because you commented.Message ID: @.***>

That did the trick! Thanks so much.

Why y’all acting like this isn’t a home assistant issue? If the above mentioned fix works, why not deploy it for everyone? It worked for me.

No one is saying it isn’t. What we’re saying is this space is for the code owners to be able to discuss the best and most resilient solution. And right now it’s unusable because of all of the off topic chatter.

If the best path forward is the proposed solution, then they will address the user agent fix PR that @Lash-L has already submitted on the source Python library. That is the proper channel for proposed fixes. If you want to discuss that fix further before it gets implemented, be my guest - but please do so in the proper channels.

As stated above, the User Agent configuration appears different and the old workaround will not work.

I did poke around some and found that in pymyq/request.py that it performs a lookup for a USER_AGENT file to set some randomness in the user agent string.

https://github.com/arraylabs/pymyq/blob/master/pymyq/request.py Line 57 url = "https://raw.githubusercontent.com/arraylabs/pymyq/master/.USER_AGENT"

That file has not been updated in 2 years and reads #RANDOM:5. The code then generates a random string of that length in request.py line 95.

I edited my request.py to point at a different file to try different lengths of randomness; this did not work unfortunately.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

    • Changed line 57 to read url = https://raw.githubusercontent.com/bigmak40/projects/main/.USER_AGENT

I tried #RANDOM:6 and #RANDOM:8 with no luck.

Change line 34 to self._useragent = None to self._useragent = str("***something here***")

obviously replace the part in stars

Someone should just close this issue at this point. This issue is doing nothing useful anymore but acting as a support thread for users.

I would like to +1 what @rale just said. It’s likely that the integration was blocked intentionally, possibly because it caused some sort of problem with their system. Vendors often don’t fully understand what is going on to cause problems, and when they spot a high volume of requests from a UA they don’t recognize it’s pretty normal for them to just block it to see what happens. Maybe this fixed the problem, maybe not. Maybe our integration really is the problem, maybe we were just collateral damage. This may not have been the only external integration that was blocked.

I sent a message to @myQConnect on Twitter pointing them to this github issue and asking that they have a product manager reach out to the maintainers. I recommend the maintainers also try to reach out directly. I am a product architect for a bot management product and I know from experience that this sort of communication between the “bot” maintainers and the affected service’s PMs is the best way to sort this out in a permanent way.

I am having the same problem.

expecting end users to read instead of just following a link in the UI? lmao

can’t the thread just be marked read-only for people who aren’t part of the organization or something? I subscribed so I can see when this bug is fixed but people replying all just to say stop replying all are part of the problem.

@tjkcc is right. Lock this thread or move the discussion somewhere else, and/or remove the link from the dashboard if you don’t want end users to come in and comment. They don’t read. They’ll never read. The user is drunk, remember?

Put proper permissions on the repo – if you don’t want comments from users, you should have discussions in a place where you can lock out the people who are just adding noise. You can’t just say “stop posting in this thread,” nobody reads. Sorry to be the bearer of bad news.

Apply the fix again. as per the discussion, any updates will require the fix to be re-applied.

I don’t see how this could be, as long as the folder is intact shouldn’t it just work?

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:
cd config
wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip
unzip useragent_fix.zip
mv pymyq-useragent_fix/pymyq .
rm -fr useragent_fix.zip pymyq-useragent_fix
  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant.

EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

Worked for me as well

I am having the same problem. When I first got my Home Assistant Yellow running I logged into myq and it worked great. With the update of 2023.9 it worked for a while and then quit. I call support at MyQ and they had no idea what Home Assistant is and thought it was with Apple then Google. When I tried to log into the MyQ web page it did not function correctly, so I think that it is their system is having problems. I really hope it can be figured out because I want it to work.

Same error 403. Failed setup, trying to initialize.

Apply the fix again. as per the discussion, any updates will require the fix to be re-applied.

They are probably using the cloudflare waf to block the user string…If it was dynamic what would it be? It may get flagged as bot traffic and get blocked other places like Akamai, Imperva etc. I’m guessing the block is in my q’s own policy. Perhaps a standard browser user agent string for my q only if possible. Or a user string my q expects to see so the traffic is under the radar.

Best option will be to replicate their mobile app’s User Agent in HA.

Looks like MyQ fixed things on their end? The integration has been working for me since 6:30am ET, Sept 21.

if that’s of any help — my integration started working at around 2am PST today no fixes applied, I was just waiting for an official fix

p.s. I understand the pain of engineers who are working on a fix, but you can’t expect end users not to use this thread while there is a direct link to github in the HA’s UI. It’s a good case to discuss with HA team. Maybe there needs to be another way to report bugs OR maybe the engineers should have a way to work on the issue separately from end users.

I can confirm that this worked for me on two HA installations that I manage with MyQ…

Some of my notes:

  1. Install the advanced SSH and web terminal addon, found here - https://github.com/hassio-addons/addon-ssh/blob/main/ssh/DOCS.md
  2. Set a username and password in the config of the addon, and disable protection mode.
  3. Start or restart the addon
  4. SSH using the webui for the addon in Home Assitant, or using your ssh client enter the following commands into your SSH terminal:
  5. paste this (without quotes) into the ui “docker exec -it homeassistant bash”
  6. paste this (without quotes) into the ui “cd /usr/local/lib/python3.11/site-packages/pymyq/”
  7. paste this (without quotes) into the ui “cp request.py request_bup.py”
  8. paste this (without quotes) into the ui “vi request.py”
  9. you will see a bunch of code to edit… hit the key “i” to enter insert mode
  10. Use your arrow keys to go modify line 34
  11. Change (without quotes) “self._useragent = None” to “self._useragent = str(“myq-ios-5.240.0.38162”)”
  12. arrow down to the end of the file
  13. hit the ESC key to close it
  14. type (without quotes) “:wq” this will close and save
  15. you should see the main screen again
  16. restart HA
  17. verify that MyQ loads

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:
cd config
wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip
unzip useragent_fix.zip
mv pymyq-useragent_fix/pymyq .
rm -fr useragent_fix.zip pymyq-useragent_fix
  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant. EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

Worked for me as well

Patch worked for me also. HA running 2023.9.2.

Is anyone experiencing this that hasn’t upgraded to 2023.9 yet? Quick look at the code, there weren’t any significant changes in this release. having same issue with: Home Assistant 2023.7.3 Supervisor 2023.09.2 Operating System 10.3

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:
cd config
wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip
unzip useragent_fix.zip
mv pymyq-useragent_fix/pymyq .
rm -fr useragent_fix.zip pymyq-useragent_fix
  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant.

EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

This works perfect… Big THX

Unfortunately, it seems like the current maintainers of this integration have been unavailable, since there has been no response and this integration has a large number of users with problems, I have created a new github organization to host a python-myq repository. This allows users who own a device to fix a problem when it pops up.

The Problem

There have been multiple arguments over what the problem actually is, here’s what I can say for sure:

  1. MyQ was having problems with their servers and has had a lot of down time the past few weeks
  2. MyQ was returning a 403 error, and when the 403 error was received, a user agent was supposed to be created, but it wasn’t.
  3. Some users had success just by changing what url they connected to myq with

My solution

I originally made sure that a user agent was always created, but due to advice from the developer of a myq implementation for a different programming language, I decided to make it only update the user agent when it fails. This is the best of both worlds, as if having a blank user agent works in the future, then nothing will change, but if it continues to not work, then a user agent will be created.

In reality, this should also cycle through the possible urls when you fail to connect, but that is not included in my change.

Going forward

I will do my best to fix some bugs, improve some things in the integration, etc. But I do not own a myq device. We need someone with python programming experience with a myq device to volunteer to take over maintaining the project. If you fit that description, I encourage you to reach out. I had done the annoying part of creating the organization, the repository, and setting up a workflow to automatically upload the code to pypi. I plan to improve some of the typing and potentially add in load balancing for the various urls. But outside of that, I am unable to test things as I do not own a device.

My goal is to include this new repository in the 2023.10 release - but that is not a certainty.

You can check out the new repository here: https://github.com/Python-MyQ/Python-MyQ and create any PRs/suggestions you may have. I encourage everyone who sees this message to limit commenting anything else on this thread, so that this message can have the highest visibility possible

Someone should just close this issue at this point. This issue is doing nothing useful anymore but acting as a support thread for users.

Seems like it should stay open until a real fix is published.

There is obviously a lot of interest and use of this MyQ integration. Is there a developer or interface owner who can give us an update on how things are going since this was opened 17 days ago?

When 10k people do the same, they’ll care. The ban hammer works against an individual or two. Not en mass. They’ll also care when their reputation gets smashed. This community under estimates their buying power due to our DIY nature.

You cannot put a link to an issue tracker like this one in the end UI and then expect users to understand what is noise and what isn’t. You have to direct them to provide the feedback you want by pointing them to the correct channels. If the correct channel is the forums, and not here, the link should not be to GitHub. If feedback on GitHub should be limited to developers in the organization, GitHub provides appropriate RBAC controls for setting those limitations if you have an Organization. You cannot expect users to follow a link to GitHub and then somehow find documentation saying that they should ask for help elsewhere. You also cannot expect end users to understand the difference between helpful and unhelpful feedback – most of them will not read the history in this thread and will think saying “me too” and maybe giving version info is helping, and that’s not their fault. They don’t know better and they cannot be expected to know better.

The onus of setting up appropriate permissions on threads like this is on the project maintainers. You can’t just repeatedly ask the thread to “STOP commenting and read random link to comment before commenting” because the people you’re trying to address won’t see those comments, or the linked ones, before they say “me too, version info”

Your appeals for appropriate usage of the thread add to the noise, they add to the problem. This isn’t a problem that can be solved with appeals, it’s a problem that has to be solved with role-based authorization for posting.

Now, I’m going to unsubscribe, because this thread doesn’t have the appropriate settings on it, and is therefore too noisy.

Ignore this advice all you want – I do have experience with open source projects, and if you want to deal with endless users saying me too and endlessly appealing to them to stop posting, be my guest. I’m just trying to help, even if it’s not information people want to hear.

You cannot put a link to an issue tracker like this one in the end UI and then expect users to understand what is noise and what isn’t. You have to direct them to provide the feedback you want by pointing them to the correct channels. If the correct channel is the forums, and not here, the link should not be to GitHub. If feedback on GitHub should be limited to developers in the organization, GitHub provides appropriate RBAC controls for setting those limitations if you have an Organization. You cannot expect users to follow a link to GitHub and then somehow find documentation saying that they should ask for help elsewhere. You also cannot expect end users to understand the difference between helpful and unhelpful feedback – most of them will not read the history in this thread and will think saying “me too” and maybe giving version info is helping, and that’s not their fault. They don’t know better and they cannot be expected to know better.

The onus of setting up appropriate permissions on threads like this is on the project maintainers. You can’t just repeatedly ask the thread to “STOP commenting and read random link to comment before commenting” because the people you’re trying to address won’t see those comments, or the linked ones, before they say “me too, version info”

Your appeals for appropriate usage of the thread add to the noise, they add to the problem. This isn’t a problem that can be solved with appeals, it’s a problem that has to be solved with role-based authorization for posting.

Now, I’m going to unsubscribe, because this thread doesn’t have the appropriate settings on it, and is therefore too noisy.

Ignore this advice all you want – I do have experience with open source projects, and if you want to deal with endless users saying me too and endlessly appealing to them to stop posting, be my guest. I’m just trying to help, even if it’s not information people want to hear.

I had to login here just to say, ME TOO! I agree with you. This is the only lucid solution to the back and forth banter… THUMBS UP. You should be the HA github moderator and admin!

I am having the same problem. When I first got my Home Assistant Yellow running I logged into myq and it worked great. With the update of 2023.9 it worked for a while and then quit. I call support at MyQ and they had no idea what Home Assistant is and thought it was with Apple then Google. When I tried to log into the MyQ web page it did not function correctly, so I think that it is their system is having problems. I really hope it can be figured out because I want it to work.

FWIW, the MyQ app works perfectly fine.

I did experience it before upgrading

On Thu, Sep 14, 2023 at 6:20 PM Bill_P @.***> wrote:

Is anyone experiencing this that hasn’t upgraded to 2023.9 yet? Quick look at the code, there weren’t any significant changes in this release. having same issue with: Home Assistant 2023.7.3 Supervisor 2023.09.2 Operating System 10.3

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/99947#issuecomment-1720275648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHBRC7OPREPU6HK6T2GA6LX2OGKZANCNFSM6AAAAAA4QV5STU . You are receiving this because you commented.Message ID: @.***>

Still broken for me. Watching.

Working for me now too. No changes.

This thread is for debugging the issue with 403 errors from MyQ. Please move discussion to the community forums or elsewhere.

I called the MyQ support staff today and they said the recently made changes to their app and servers, and that they do not recognize Home Assistant as a valid partner. They recommended I switch to IFTTT or Alarm.com as those partners have a supported status. This bites.

I rolled back to 2023.8.4 and it’s still not working, so I’m not 100% convinced that this is a 2023.9 issue

Getting the same error, following thread for solution

Any ETA on when a fix will be out for this? Don’t really want to do the workaround…

After all aren’t we all CUSTOMERS after all?

No. You realize you are supposed to buy their proprietary hub for HomeKit

9,088 people have this integration installed. If 10k-ish people threaten to stop using their products, that’s a tremendous amount of leverage. Unfortunately this disorganized and somewhat hostile group is the opposite of banding together.

Reality is, they don’t give sh*t. They’ve already sold the opener. They don’t even support integrations they claim to on the box…. I managed to get myself banned from MyQ’s Facebook page just for asking about it, and not being happy with a canned non-answer answer.

Amen

From: virtualo1 @.> Sent: Friday, September 15, 2023 11:50 PM To: home-assistant/core @.> Cc: Robert Perkins @.>; Comment @.> Subject: Re: [home-assistant/core] MyQ fails with 403 forbidden error after recent cloud changes (Issue #99947)

You cannot put a link to an issue tracker like this one in the end UI and then expect users to understand what is noise and what isn’t. You have to direct them to provide the feedback you want by pointing them to the correct channels. If the correct channel is the forums, and not here, the link should not be to GitHub. If feedback on GitHub should be limited to developers in the organization, GitHub provides appropriate RBAC controls for setting those limitations if you have an Organization. You cannot expect users to follow a link to GitHub and then somehow find documentation saying that they should ask for help elsewhere. You also cannot expect end users to understand the difference between helpful and unhelpful feedback – most of them will not read the history in this thread and will think saying “me too” and maybe giving version info is helping, and that’s not their fault. They don’t know better and they cannot be expected to know better.

The onus of setting up appropriate permissions on threads like this is on the project maintainers. You can’t just repeatedly ask the thread to “STOP commenting and read random link to comment before commenting” because the people you’re trying to address won’t see those comments, or the linked ones, before they say “me too, version info”

Your appeals for appropriate usage of the thread add to the noise, they add to the problem. This isn’t a problem that can be solved with appeals, it’s a problem that has to be solved with role-based authorization for posting.

Now, I’m going to unsubscribe, because this thread doesn’t have the appropriate settings on it, and is therefore too noisy.

Ignore this advice all you want – I do have experience with open source projects, and if you want to deal with endless users saying me too and endlessly appealing to them to stop posting, be my guest. I’m just trying to help, even if it’s not information people want to hear.

You cannot put a link to an issue tracker like this one in the end UI and then expect users to understand what is noise and what isn’t. You have to direct them to provide the feedback you want by pointing them to the correct channels. If the correct channel is the forums, and not here, the link should not be to GitHub. If feedback on GitHub should be limited to developers in the organization, GitHub provides appropriate RBAC controls for setting those limitations if you have an Organization. You cannot expect users to follow a link to GitHub and then somehow find documentation saying that they should ask for help elsewhere. You also cannot expect end users to understand the difference between helpful and unhelpful feedback – most of them will not read the history in this thread and will think saying “me too” and maybe giving version info is helping, and that’s not their fault. They don’t know better and they cannot be expected to know better.

The onus of setting up appropriate permissions on threads like this is on the project maintainers. You can’t just repeatedly ask the thread to “STOP commenting and read random link to comment before commenting” because the people you’re trying to address won’t see those comments, or the linked ones, before they say “me too, version info”

Your appeals for appropriate usage of the thread add to the noise, they add to the problem. This isn’t a problem that can be solved with appeals, it’s a problem that has to be solved with role-based authorization for posting.

Now, I’m going to unsubscribe, because this thread doesn’t have the appropriate settings on it, and is therefore too noisy.

Ignore this advice all you want – I do have experience with open source projects, and if you want to deal with endless users saying me too and endlessly appealing to them to stop posting, be my guest. I’m just trying to help, even if it’s not information people want to hear.

I had to login here just to say, ME TOO! I agree with you. This is the only lucid solution to the back and forth banter… THUMBS UP. You should be the HA github moderator and admin!

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/99947#issuecomment-1722124145, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH55NHZ4HL45VOSBTGT3UFLX2UOWFANCNFSM6AAAAAA4QV5STU. You are receiving this because you commented.Message ID: @.@.>>

expecting end users to read instead of just following a link in the UI? lmao

can’t the thread just be marked read-only for people who aren’t part of the organization or something? I subscribed so I can see when this bug is fixed but people replying all just to say stop replying all are part of the problem.

@tjkcc is right. Lock this thread or move the discussion somewhere else, and/or remove the link from the dashboard if you don’t want end users to come in and comment. They don’t read. They’ll never read. The user is drunk, remember?

Put proper permissions on the repo – if you don’t want comments from users, you should have discussions in a place where you can lock out the people who are just adding noise. You can’t just say “stop posting in this thread,” nobody reads. Sorry to be the bearer of bad news.

It’s not that comments from users aren’t wanted. They are! IF they are providing new information related to the issue which could be helpful in coming up with a solution. That kind of input is super valuable and part of what makes open source work. Everything else however is just noise

if youre using docker do this

docker exec -it homeassistant bash
cd /usr/local/lib/python3.11/site-packages/pymyq
cp garagedoor.py garagedoor.py.bak
cp const.py const.py.bak
sed -i 's|https://account-devices-gdo.myq-cloud.com/|https://account-devices-gdo-east.myq-cloud.com/|g' garagedoor.py
sed -i 's|https://account-devices-gdo.myq-cloud.com/|https://account-devices-gdo-east.myq-cloud.com/|g' const.py
sed -i 's|https://devices.myq-cloud.com/|https://devices-east.myq-cloud.com/|g' const.py

Soo many posts confirming the work-around works… Instead lets save the discussion board for those familiar with the issue and looking to implement a PERMANENT fix.

If the fix works simply thumbs up the post. If its not working, make no assumptions and follow this guide to the letter https://github.com/home-assistant/core/issues/99947#issuecomment-1712728640 (Copy and paste the url)

Here’s to a resolution that lasts through the updates.

Ok, to summarize AFAIK for those of us using HASSOS / HAOS, from reading the solutions above, with full credit to @bigmak40, @buskeyl, and @PrplHaz4 (and many others), from scratch:

  1. Install the advanced SSH and web terminal addon, found here - https://github.com/hassio-addons/addon-ssh/blob/main/ssh/DOCS.md
  2. Set a username and password in the config of the addon, and disable protection mode.
  3. Start or restart the addon
  4. SSH using the webui for the addon in Home Assitant, or using your ssh client
  5. enter the following commands into your SSH terminal:
docker exec -it homeassistant bash
cd /usr/local/lib/python3.11/site-packages/pymyq/
cp request.py request_bup.py
vi request.py
i to enter insert mode
Modify line 34

    Was self._useragent = None
    Is self._useragent = str("myq-ios-5.240.0.38162")
  1. restart home assistant

This showed up over on Scrypted as well, and it’s worth noting that the entire MyQ web application appears to have shutdown which is strong candidate for root cause. image

FOR THE LOVE OF… Stop contacting MyQ and alerting them to the presence of this unofficial use of their API! 🤦

This is an absolutely absurd statement. The API is blocked BECAUSE you’re doing it this way.

Randomly started working again anyone else?

Same

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:
cd config
wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip
unzip useragent_fix.zip
mv pymyq-useragent_fix/pymyq .
rm -fr useragent_fix.zip pymyq-useragent_fix
  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant. EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

This doesn’t work in the container. Any method that does?

This fixed my issue. Thanks

This worked for me also. Thank you so much!!!

If you’re using the Samba addon you can do this instead of ssh:

  1. Download https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip somewhere temporary
  2. Drap the pymyq folder inside the zip to \\your_samba_share_HA\config
  3. Restart HA

I can confirm that this worked for me on two HA installations that I manage with MyQ… Some of my notes:

  1. Install the advanced SSH and web terminal addon, found here - https://github.com/hassio-addons/addon-ssh/blob/main/ssh/DOCS.md
  2. Set a username and password in the config of the addon, and disable protection mode.
  3. Start or restart the addon
  4. SSH using the webui for the addon in Home Assitant, or using your ssh client enter the following commands into your SSH terminal:
  5. paste this (without quotes) into the ui “docker exec -it homeassistant bash”
  6. paste this (without quotes) into the ui “cd /usr/local/lib/python3.11/site-packages/pymyq/”
  7. paste this (without quotes) into the ui “cp request.py request_bup.py”
  8. paste this (without quotes) into the ui “vi request.py”
  9. you will see a bunch of code to edit… hit the key “i” to enter insert mode
  10. Use your arrow keys to go modify line 34
  11. Change (without quotes) “self._useragent = None” to “self._useragent = str(“myq-ios-5.240.0.38162”)”
  12. arrow down to the end of the file
  13. hit the ESC key to close it
  14. type (without quotes) “:wq” this will close and save
  15. you should see the main screen again
  16. restart HA
  17. verify that MyQ loads

It works for those of you running HA in Docker. 😉

Tried that but it seems to be getting cleared after reboot (HASS Docker Container)

I called the MyQ support staff today and they said the recently made changes to their app and servers, and that they do not recognize Home Assistant as a valid partner. They recommended I switch to IFTTT or Alarm.com as those partners have a supported status. This bites.

Not surprising considering random nonsense UAs are being accepted, that indicates this integration was intentionally blacklisted.

I can’t be too mad since I’ve gotten I think almost two years of free API access they apparently didn’t intend on a $15 Black Friday purchase. But I’m moderately mad, and I feel for anyone who bought an actual full-fledged smart garage door opener. I’m gonna keep spoofing my UA as long as that continues to work though.

You have no clue what you’re talking about, just stop.

Home assistant isn’t sending a user agent and the lack of one is being blocked. If people are going to continue to reply here please at least read the comments that are already here…

There have been more comments here about how to implement the fix I put out than actual constructive comments about how we get a fixed version released. If editing a text file in linux is that hard for some of you, it’s probably not something you should be doing as you may end up breaking your entire HA install because you edited the wrong file entirely.

Sorry to sound harsh here but it’s the truth.

Thanks @lygris, that did work.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

Is there a way to do this using HassOS?

if you’re using the ssh addon (Advanced SSH & Web Terminal) , you have to disable “protection mode” and restart the addon. Then follow the steps above

Just tried it and fixed for me (for the time being)

@ceddy441 is right.

This is what HA is passing as a user agent. My guess is they have blocked that. Changing the user agent to simply “PyMyq” got it working for me. Sounds like we need to override the HA-supplied user agent

{'User-Agent': 'HomeAssistant/2023.9.0.dev0 aiohttp/3.8.5 Python/3.11'}

I would honestly take a look at the Pymq library first. I WIll update y’all when I get a chance. https://github.com/arraylabs/pymyq/tree/master

The MyQ app on my phone is working as well. What version of HAC is everyone running (since that was recently released).

I’m Running: Home Assistant 2023.9.0 Supervisor 2023.08.3 Operating System 10.5 Frontend 20230906.1 - latest

By the way, I also tried removing/restoring power but NOJOY.

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:
cd config
wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip
unzip useragent_fix.zip
mv pymyq-useragent_fix/pymyq .
rm -fr useragent_fix.zip pymyq-useragent_fix
  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant. EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

Worked for me as well

Just wanted to add that this worked for me as well . . . at least for now. And I ran it from the “regular” terminal & ssh ad on.

No joy here…

  • reloaded MyQ integration -still fails with 403.
  • restarted HA (via developer tools->restart).: -still fails with 403
  • restarted docker instance (docker restart home_assistant): -still fails with 403.

no changes, no edits, no modifications.

docker exec -it homeassistant sed -i.bak "34s/None/str(\"ha${RANDOM}\")/" /usr/local/lib/python3.11/site-packages/pymyq/request.py

Made the one-liner random for people to make it easier. No interactive editing mistakes required.

Why doesn’t someone just fix the integration?

Thanks @lygris, that did work.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

Is there a way to do this using HassOS?

I don’t think the fix from several years ago will work, the path is no longer correct and neither is the string its trying to replace.

@ceddy441 is right.

This is what HA is passing as a user agent. My guess is they have blocked that. Changing the user agent to simply “PyMyq” got it working for me. Sounds like we need to override the HA-supplied user agent

{'User-Agent': 'HomeAssistant/2023.9.0.dev0 aiohttp/3.8.5 Python/3.11'}

Where do you change that at?

Same issue here

Just to respond generally to everyone here

There are a significant amount of differences between the different implementations of the myq api. Especially because base packages are doing things differently.

I have made next to no fundamental change to the code, staying on the side of caution. The only thing is that when the 403 error pops up, it creates a user agent, just like it did for 401 errors. I did this because of the conversations and posts from the developer of the other implementation. If another problem is found and resolved, then the code change I made will never even be touched, and a user agent wont be set. If user agents are no longer required, then the code change I made will never be touched. If things stay as they are now, and adding a user agent fixes the problem as it does for the vast majority of people, then it will continue to work.

Regardless, for more changes to be made, if the UA fix does not fix things, we still need a new repository as the old one is inactive. This is still a needed step.

I hear everyone’s concerns - but at this point they have all been said, and with the information I have, I think this is the best route forward. If you have further concerns about the UA fix, I encourage you to find a different solution you want implemented and create an issue on the Python package. Until then, until this fix is officially included in HA, I think everyone should avoid saying if it works or does not work for them.

I would like to again link back to my first post for anyone who is seeing the thread at this point: https://github.com/home-assistant/core/issues/99947#issuecomment-1735928950

Someone should just close this issue at this point. This issue is doing nothing useful anymore but acting as a support thread for users.

Seems like it should stay open until a real fix is published.

I have to agree when I think about it. The issue is still happening. People need to just stop posting in here saying that the workaround works for them. Either use the workaround or don’t, and maybe that should be indicated somewhere that there is a “workaround” until the actual fix goes in.

I too would rather wait for a fix than do the workaround. Hopefully soon

On the last line, I got the following:

Mv: unrecognized option: r

From: hasibb7 @.> Sent: Wednesday, September 20, 2023 10:23 AM To: home-assistant/core @.> Cc: Robert Perkins @.>; Comment @.> Subject: Re: [home-assistant/core] MyQ fails with 403 forbidden error after recent cloud changes (Issue #99947)

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:

cd config

wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip

unzip useragent_fix.zip

mv pymyq-useragent_fix/pymyq .

rm -fr useragent_fix.zip pymyq-useragent_fix

  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant.

EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

Worked for me as well

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/99947#issuecomment-1727834463, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH55NH7GURCHPGHY73F72QDX3L32NANCNFSM6AAAAAA4QV5STU. You are receiving this because you commented.Message ID: @.@.>>

The integration working intermittently is consistent with there being a MyQ load balancer issue, which was mentioned by the pymyq owner earlier in this (quite long) thread. Intermittent functionality would also argue in favor of it not being an issue with the UserAgent and the “solution” being to just wait out MyQ fixing the issues with their cloud resources.

FWIW, whatever the HomeBridge plugin is doing, it’s different than the MyQ client for HA. Since I already have HomeBridge running for other devices, I added the MyQ HomeBridge plugin today and seems to work fine. Simultaneously, my HA MyQ integration is still showing everything as Unavailable.

FOR THE LOVE OF… Stop contacting MyQ and alerting them to the presence of this unofficial use of their API! 🤦

We wouldn’t have to go through their API if they would expose a local endpoint for which we can poll and operate the device.

I did nothing and it started working on its own.

It would be great to be able to configure the heartbeats so we can better avoid hitting WAF limits.

You might be able to . If you disable polling on the integration settings page, you can create a time-based pattern automation that runs homeassistant.update_entity (see https://www.home-assistant.io/docs/scripts/service-calls/#homeassistant-services) that might work. I use that approach to on some of my integrations to improve performanc or customize incoming data frequency.

I do not know if MyQ works with this, however.

Same error 403. Failed setup, trying to initialize.

This DOES work… Install the Advanced SSH & Web Terminal add-on In the terminal add-on, run the following commands: cd config wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip unzip useragent_fix.zip mv pymyq-useragent_fix/pymyq . rm -fr useragent_fix.zip pymyq-useragent_fix Restart Home Assistant

Fixed it for me too on HA 2023.4.4

Not for me:

image

@djonk what region are you in? I’m just collecting regional info that might help us understand if there is a pattern. I am in US East and it’s the same (not working).

EDIT: Taking the conversation here: https://community.home-assistant.io/t/myq-not-working-again/193086/272 - suggest others do as well.

Yes… and now randomly NOT working again this morning. On 9/11/2023 11:25:15 PM, P @.> wrote: Randomly started working again anyone else? Same — Reply to this email directly, view it on GitHub [https://github.com/home-assistant/core/issues/99947#issuecomment-1714906289], or unsubscribe [https://github.com/notifications/unsubscribe-auth/AHI6JKCK5ZER5QS7VUCJS33XZ7IZXANCNFSM6AAAAAA4QV5STU]. You are receiving this because you were mentioned.Message ID: @.>

Mine did NOT start working on it’s own, but the above fix of the wget download worked for me.

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:

cd config wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip unzip useragent_fix.zip mv pymyq-useragent_fix/pymyq . rm -fr useragent_fix.zip pymyq-useragent_fix

  1. Restart Home Assistant

On Mon, Sep 11, 2023 at 12:36 PM Ramesh Swamy @.***> wrote:

Would somebody be kind enough to tell me what simple thing I’m missing? I can’t get the the docker exec command working in HAOS via the shell add-on. It’s returning “bash: user: command not found”.

try using sh or /bin/sh .

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/99947#issuecomment-1714312371, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMH65A7TJFI6QSNCZLBBSEDXZ5D3HANCNFSM6AAAAAA4QV5STU . You are receiving this because you commented.Message ID: @.***>

– Kirk Sciacca Sr @.***

This is the easiest solution/workaround for now: #99947 (comment)

True, but can we all agree that MyQ stinks

MyQ has been practically flawless for me, I like it and hope we can get this interface restored.

MyQ is not good. If you setup notifications for door status change you’ll see that the cloud constantly goes offline and back online. Also the fact that it’s cloud based with no local access is pretty trash too.

Also, not to mention that MyQ charges you a $45/year subscription fee to use the MyQ integration in Tesla vehicles.

I’m hoping Konnected releases a version of their garage panels to work with Liftmaster units, I’ll drop MyQ in a heartbeat for a local controller.

It does not and you should not. A UA field is neither required, nor would I recommend using one, but I defer to the HA myQ folks. For those who think a UA field is required: they are not.

Again I don’t have a myQ device, but I’m chiming in as an outsider. In that link you sent - there are multiple comments stating that sometimes lack of UserAgent will result in being blocked.

I am fully on board with the concept of load balancing also being a problem, but here’s my opinion on how things probably went down.

  1. MyQ is experiencing issues load balancing between east and west
  2. They try to figure out what is happening to cause all of these issues
  3. Having more traffic than expected, they analyze the incoming request, and see a large amount of request with a undefined user-agent, which they can confirm is not part of their app or their partner apps - In an attempt to relieve stress off of their servers, they block undefined user-agents from accessing through the load balance ip.

In my opinion just from reading the threads, it seems like there are two different problems here

The load balancing url/ Azure issue you talk about and the User agent. Which would explain why the user agent fix removes the problem for some people but not for others. I think automatically trying to rotate through the regions when the load balancer url fails would be a good improvement - but hopefully wont be needed if MyQ gets their load balancing handled - but I still believe the user agent should be defined

following for an official fix

I can confirm that this worked for me on two HA installations that I manage with MyQ…

Some of my notes:

  1. Install the advanced SSH and web terminal addon, found here - https://github.com/hassio-addons/addon-ssh/blob/main/ssh/DOCS.md
  2. Set a username and password in the config of the addon, and disable protection mode.
  3. Start or restart the addon
  4. SSH using the webui for the addon in Home Assitant, or using your ssh client enter the following commands into your SSH terminal:
  5. paste this (without quotes) into the ui “docker exec -it homeassistant bash”
  6. paste this (without quotes) into the ui “cd /usr/local/lib/python3.11/site-packages/pymyq/”
  7. paste this (without quotes) into the ui “cp request.py request_bup.py”
  8. paste this (without quotes) into the ui “vi request.py”
  9. you will see a bunch of code to edit… hit the key “i” to enter insert mode
  10. Use your arrow keys to go modify line 34
  11. Change (without quotes) “self._useragent = None” to “self._useragent = str(“myq-ios-5.240.0.38162”)”
  12. arrow down to the end of the file
  13. hit the ESC key to close it
  14. type (without quotes) “:wq” this will close and save
  15. you should see the main screen again
  16. restart HA
  17. verify that MyQ loads

It works for those of you running HA in Docker. 😉

I can confirm that this worked for me on two HA installations that I manage with MyQ…

Some of my notes:

  1. Install the advanced SSH and web terminal addon, found here - https://github.com/hassio-addons/addon-ssh/blob/main/ssh/DOCS.md
  2. Set a username and password in the config of the addon, and disable protection mode.
  3. Start or restart the addon
  4. SSH using the webui for the addon in Home Assitant, or using your ssh client enter the following commands into your SSH terminal:
  5. paste this (without quotes) into the ui “docker exec -it homeassistant bash”
  6. paste this (without quotes) into the ui “cd /usr/local/lib/python3.11/site-packages/pymyq/”
  7. paste this (without quotes) into the ui “cp request.py request_bup.py”
  8. paste this (without quotes) into the ui “vi request.py”
  9. you will see a bunch of code to edit… hit the kiy “i” to enter insert mode
  10. Use your arrow keys to go modify line 34
  11. Change (without quotes) “self._useragent = None” to “self._useragent = str(“myq-ios-5.240.0.38162”)”
  12. arrow down to the end of the file
  13. hit the ESC key to close it
  14. type (without quotes) “:wq” this will close and save
  15. you should see the main screen again
  16. restart HA
  17. verify that MyQ loads

Worked Perfectly for me!! Thank you!

You can copy the whole pymyq folder from /usr/local/lib and put it in your config directory (where configuration.yaml is), and it will override the one from /usr/local/lib. This method will survive updates. It also makes it easy to revert, since you can just rename the pymyq folder.

So where would this file be on a Home Assistant Yellow?

So I was able to implement the workaround once I realized that the docker command is still required for the Home Assistant Yellow platform. For Yellow at least, you WILL have the “/usr/local/lib/” path before running the docker command, but you will not see what you expect to see there because you aren’t actually in the container yet.

This worked for me.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

Just tried with self._useragent = str(“JFKEJ”) Started working now after restarting Home Assistant

Thanks @lygris

@ceddy441 is (again) correct: We should expose the UA as a configuration variable (initially filled with a dynamic string). As long as the API exists and the strings remain pattern-free (e.g., not all UUIDs), it will work fine.

My instance was not working with 2023.8.3. I upgraded to 2023.9.0 after it stopped working and it was still not working after the upgrade. Seems unrelated to 2023.9.

I have not updated and it does not work. It quit at the same time everyone else had noted earlier.

that would be odd; given that it happened right after people updated to HA 2023.9, I’d suspect it is tied directly to that

I think this is it. Mine was working 12 minutes ago (12:17 PM PST) and I just upgraded to 2023.9 and it’s now broken.

Following

Stopped working @ 10:47am EST like everyone else Power cycle did not fix App is working fine

Possibly another API change on Chamberlain’s side?

Please, please… stop posting unless you really have something useful to add.

Practice what you preach?

While I appreciate the work your doing on trying to provide a fix, as I personally stated on your other PR I dont believe it resolved the underlying issue which is unrelated to user agents. I think work/investment needs to go into the root cause as to why this seems to be broken only on HA and not other systems.

Seeing as how messing with user agents is what fixes the issue for most, and I’m fairly certain the ones it didn’t work for are simply doing it wrong, I’m curious what makes you say this.

Further, what “other systems” are you referring to which aren’t breaking?

While I can understand wanting to assume this is a magical fix that works, trying to blame others and claim that we are just doing it wrong is just inherent confirmation basis by you. Id repeatedly offered to provide anyone any logs, testing, or evidence to show Ive tried this user agent change and it simply does not work.

While I am not saying it doesnt resolve the issue for some, the fact that it doesnt resolve the issue for everyone strongly implies its not the root cause.

As for your second question about other systems you can refer to this post where its stated only HA is experiencing issues, https://github.com/arraylabs/pymyq/pull/182#issuecomment-1719870223

Edit: Credit to @jeffgeorge beating me to the post about “other systems”

Please heed the warnings in this and other threads about the potential risks of just adding a user agent. While it seems setting a user agent solves the problem in most situations, I’d hate to see you go through the effort of getting HA switched over to a “working” fork of pymyq just to get the entire HA install-base banned by MyQ due to user agent shenanigans.

I deleted my fork as I am rehosting the original repository here: https://github.com/Python-MyQ/Python-MyQ

Seemingly the current maintainers are inactive, so after some discussion, I decided to rehost the repository so I can put forth an actual fix into HA.

When I deleted my fork, I didn’t think about the fact that users were copying my fork into their code to make changes.

Once I have the pipeline working, I will add it into HA. I am looking for someone who is willing to take on maintaining this project, as I do not have a MyQ and I am not a good long term solution. I will post a longer message in this issue later.

Agreed, but at this point this issue isnt providing any value to anyone besides providing tech support really. I do agree this issue is still ongoing though just that none of the “fixes” are true working fixes and there is something else going on.

And mine stopped working again…Best Regards,Jules Ryckebusch On Sep 18, 2023, at 15:10, Adamo Maisano @.***> wrote:

I did nothing and it started working on its own. It would be great to be able to configure the heartbeats so we can better avoid hitting WAF limits.

You might be able to . If you disable polling on the integration settings page, you can create a time-based pattern automation that runs homeassistant.update_entity (see https://www.home-assistant.io/docs/scripts/service-calls/#homeassistant-services) that might work. I use that approach to on some of my integrations to improve performanc or customize incoming data frequency. I do not know if MyQ works with this, however.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

FOR THE LOVE OF… Stop contacting MyQ and alerting them to the presence of this unofficial use of their API! 🤦

This is an absolutely absurd statement. The API is blocked BECAUSE you’re doing it this way.

I understand where you are coming from, but this is a company that charges for application integration. If you have a Tesla, you can pay them yearly for app integration with the car. Otherwise, no service. Similarly, it seems that companies like alarm.com and amazon key paid to be partners. They haven’t built out a path for free third party apps, and afaict, this is completely intentional.

Asking is great, but they have a business model that is intentionally designed to be incompatible with free usage. You are very unlikely to get what you want. Unless you want a paywall. They might give you that. 😦

Same error 403. Failed setup, trying to initialize.

This DOES work… Install the Advanced SSH & Web Terminal add-on In the terminal add-on, run the following commands:

cd config wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip unzip useragent_fix.zip mv pymyq-useragent_fix/pymyq . rm -fr useragent_fix.zip pymyq-useragent_fix Restart Home Assistant

Fixed it for me too on HA 2023.4.4

This is much simpler. It also prevents any typo’s or other mistakes.

docker exec -it homeassistant sed -i.bak “34s/None/str("ha${RANDOM}")/” /usr/local/lib/python3.11/site-packages/pymyq/request.py

@bigmak40

Thanks @lygris, that did work.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

Given that user agents are a somewhat common cause of things breaking, what about having a config variable for the user agent with it pre-populated to the browser / app at the time of configuration?

Interesting turn of events, but this integration just started working for me again without making any changes (I did not apply any of the suggested work-around in this thread).

So it seems like Chamberlain made some other changes – presumably once again allowing empty user-agent values

Same here

+1 — made no changes to HAOS and it works now

Interesting turn of events, but this integration just started working for me again without making any changes (I did not apply any of the suggested work-around in this thread).

So it seems like Chamberlain made some other changes – presumably once again allowing empty user-agent values

If you’re using the Samba addon you can do this instead of ssh:

  1. Download https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip somewhere temporary
  2. Drap the pymyq folder inside the zip to \your_samba_share_HA\config
  3. Restart HA

Yay! Thank you.

I tried the commands at least 4 times and it did not work but your simple method worked like a charm. Thanks for sharing

could someone dumb this down for me so i can get this working again

  1. Install the Advanced SSH & Web Terminal add-on
  2. In the terminal add-on, run the following commands:
cd config
wget https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip
unzip useragent_fix.zip
mv pymyq-useragent_fix/pymyq .
rm -fr useragent_fix.zip pymyq-useragent_fix
  1. Restart Home Assistant

When the fix is finally made to HA, just remove the config/pymyq folder and restart Home Assistant. EDIT: You can also run these commands in the regular Terminal & SSH add-on. The above does not need access to the homeassistant Docker container, so you don’t need to run the add-on in protected mode. This works because Python libraries in the config directory take precedence over libraries in other places.

This doesn’t work in the container. Any method that does?

This fixed my issue. Thanks

It does not and you should not. A UA field is neither required, nor would I recommend using one, but I defer to the HA myQ folks. For those who think a UA field is required: they are not.

Again I don’t have a myQ device, but I’m chiming in as an outsider. In that link you sent - there are multiple comments stating that sometimes lack of UserAgent will result in being blocked.

I am fully on board with the concept of load balancing also being a problem, but here’s my opinion on how things probably went down.

  1. MyQ is experiencing issues load balancing between east and west
  2. They try to figure out what is happening to cause all of these issues
  3. Having more traffic than expected, they analyze the incoming request, and see a large amount of request with a undefined user-agent, which they can confirm is not part of their app or their partner apps - In an attempt to relieve stress off of their servers, they block undefined user-agents from accessing through the load balance ip.

In my opinion just from reading the threads, it seems like there are two different problems here

The load balancing url/ Azure issue you talk about and the User agent. Which would explain why the user agent fix removes the problem for some people but not for others. I think automatically trying to rotate through the regions when the load balancer url fails would be a good improvement - but hopefully wont be needed if MyQ gets their load balancing handled - but I still believe the user agent should be defined

This will be my last post to this thread. 😄

Correlation isn’t causation. UA’s have not been historically required in the v6 API - nor are they required by the HTTP specification. Putting a UA in there only serves the interest of further data collection and potential future blacklisting, should such a path be chosen. As a historical note: this strategy has been tried in the past (including by my implementation of the API prior to my reverse-engineering of the current API revision), and it did lead to blacklisting at various points and an ever changing number of updates to become an arms race of sorts with myQ. This is not the way.

I’ve got the better part of a decade of experience with this API. It doesn’t suddenly break due to API changes, typically. Nothing about this bear the hallmarks of an API change.

Rotating regions when a failure mode occurs is a reasonable failsafe, one which I have been implemented as a manual workaround, and will be automated in the future for my Homebridge plugin and Node API.

HA Devs: feel free to ping me on Discord if you’d like to discuss some of the more esoteric aspects. Best of luck all.

  1. Install the advanced SSH and web terminal addon, found here - https://github.com/hassio-addons/addon-ssh/blob/main/ssh/DOCS.md
  2. Set a username and password in the config of the addon, and disable protection mode.
  3. Start or restart the addon
  4. SSH using the webui for the addon in Home Assitant, or using your ssh client enter the following commands into your SSH terminal:
  5. paste this (without quotes) into the ui “docker exec -it homeassistant bash”
  6. paste this (without quotes) into the ui “cd /usr/local/lib/python3.11/site-packages/pymyq/”
  7. paste this (without quotes) into the ui “cp request.py request_bup.py”
  8. paste this (without quotes) into the ui “vi request.py”
  9. you will see a bunch of code to edit… hit the key “i” to enter insert mode
  10. Use your arrow keys to go modify line 34
  11. Change (without quotes) “self._useragent = None” to “self._useragent = str(“myq-ios-5.240.0.38162”)”
  12. arrow down to the end of the file
  13. hit the ESC key to close it
  14. type (without quotes) “:wq” this will close and save
  15. you should see the main screen again
  16. restart HA
  17. verify that MyQ loads

Worked for me using the Advanced SSH & Web Terminal Addon in a virtualbox machine on a windows pc. Thanks very much to the OP above!

docker exec -it homeassistant sed -i.bak "34s/None/str(\"ha${RANDOM}\")/" /usr/local/lib/python3.11/site-packages/pymyq/request.py

Made the one-liner random for people to make it easier. No interactive editing mistakes required.

🎉 Excellent @calisro ! This is the most reliable thing to do, whether you’re a newbie or not. (Actually you don’t even need the -it, since the sed command requires neither interactivity nor a TTY)

A good quick workaround thanks to @calisro

  1. Install HACS if you don’t have it

  2. Using HACS, search for the Advanced SSH & Web Terminal and install it

  3. Go to the add-on settings and disable “Protection Mode”

  4. Open the addon Web UI. You’ll see a shell prompt

  5. Paste the following and press enter:

docker exec homeassistant sed -i.bak "34s/None/str(\"ha${RANDOM}\")/" /usr/local/lib/python3.11/site-packages/pymyq/request.py
  1. Restart Home Assistant.

Caveats

  • This fix won’t survive an upgrade. You’re editing the source code, which gets replaced on every upgrade.
  • MyQ may still lock down their API even harder, and then even this workaround won’t work. Get a Shelly relay or something and connect it to your garage door button contacts!
  • You need to be running Home Assistant OS, which most users are. If you’re not, then you probably know what to do instead.

Explanation

If you’re not an expert, but you do wanna know exactly what code is doing before you run it on your own hardware (and good on you for that), here’s what it does.

  1. docker – Manage the “containers” Home Assistant uses to organize functionality
  2. exec homeassistant – Run a command inside the “homeassistant” or core container
  3. sed -i.bak – Use the “stream editor” to modify a file in place (and save a backup)
  4. "34s/None/str(\"ha${RANDOM}\")/" On line 34 of that file, replace “None” with the text “ha” and then a random number.
  5. /usr/local/lib/python3.11/site-packages/pymyq/request.py Do that to this file, which contains the code for talking to the MyQ server.

@Am0din, running this docker command first to access the referenced directory/file is required in ALL installation types (HAOS, VM, Yellow etc.) and is not only for HA on docker:

“docker exec -it homeassistant bash”

Worked for me !!

cd /usr/local/lib/python3.11/site-packages/pymyq/
cp request.py request_bup.py
vi request.py
i to enter insert mode
Modify line 34

    Was self._useragent = None
    Is self._useragent = str("anytexthere")```

still not happening. did i unzip the file to the wrong spot? i was in config, i would have thought that is where it would have gone. Screenshot 2023-09-09 120618

In the original instructions, I had you “cd config” first, then run the commands. To try again, first do “cd config”, then do “ls” to see the contents of the directory. Then, clean up any remnants from previous tries. Look for useragent_fix and pymyq files/folders, and remove them all with appropriate “rm -fr” commands. Then, run the rest of the commands from my post.

so found that dir using the LS command, (i was actually trying “dir” to see what was in config and getting annoyed I didn’t know the right command to see the directory , thanks for that old DOS commands coming back into my head here)

I was able to remove it by leaving the “Config/” off your original remove command,

went thru the steps from the OP again and unfortunately it still fails with the move command as it originally did.

Despite the fails in the terminal I rebooted and MyQ is connected with no errors now, so guess it did work!!

Thanks you so much for helping me thru this, I’m slowly trying to learn this stuff.

Thanks.

Yep, they are not blocking user-agent = homeassistant so it must be couldfare barfing on no agent string provided.

Above I posted a discussion from 3 years ago. The UA was purposely removed because Chamberlain was blocking our HA useragent. Its possible they moved their WAF to a service that now requires it for DDOS mitigation.

Fix worked for me. I decided to set the user agent string to something that would express my displeasure to Chamberlain, but I would probably be admonished for my language if I posted the exact string here.

Thanks @lygris, that did work.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

Is there a way to do this using HassOS?

This worked for me!!

I am using: Home Assistant 2023.9.1 Supervisor 2023.08.3 Operating System 10.5

I had to install the Advanced SSH & Web Terminal add-on, which required some troubleshooting on it’s own (bad gateway error, fix was to set a password in the config tab).

Once I got that running and disabled protection mode, I followed the steps above to browse and edit the request.py file. A quick restart later and everything came back online.

Thanks everyone, great community here!

I’m really tempted to use WireShark on my firewall to monitor the transactions between the MyQ app on my phone and the servers to which it “talks.” It would provide a definitive answer of what they do between their API and their App.

As stated above, the User Agent configuration appears different and the old workaround will not work.

I did poke around some and found that in pymyq/request.py that it performs a lookup for a USER_AGENT file to set some randomness in the user agent string.

https://github.com/arraylabs/pymyq/blob/master/pymyq/request.py Line 57 url = "https://raw.githubusercontent.com/arraylabs/pymyq/master/.USER_AGENT"

That file has not been updated in 2 years and reads #RANDOM:5. The code then generates a random string of that length in request.py line 95.

I edited my request.py to point at a different file to try different lengths of randomness; this did not work unfortunately.

  • docker exec -it homeassistant bash
  • cd /usr/local/lib/python3.11/site-packages/pymyq/
  • cp request.py request_bup.py
  • vi request.py
    • Changed line 57 to read url = https://raw.githubusercontent.com/bigmak40/projects/main/.USER_AGENT

I tried #RANDOM:6 and #RANDOM:8 with no luck.

@devs - If possible can we expose the user agent as a variable in the GUI? This way end-users can populate it themselves reducing the risk of Chamberlain blocking by regex.

My skillset is in network design, or I would attempt myself.

From the link shared by @ceddy441 (https://community.home-assistant.io/t/myq-not-working-again/193086/139) :

This will restore full functionality to myQ without requiring individual users to edit the User Agent string in their python implementation. This should solve the issue until Chamberlain comes up with some other cheesy way to prevent people from legitimately using the API. Here’s hoping that will take a long, long time.

That was December 2020… almost 3 years…

Understood. But three years ago Chamberlain blocked our useragent. A temp fix was to manually modify and create your own useragent https://community.home-assistant.io/t/myq-not-working-again/193086/113. Later on a fix was created in hopes that it would last long term.

If MyQ works outside of HA on the same network, we should look at the useragent as history has a way of repeating itself.

I rolled back to 2023.8.4 and it’s still not working, so I’m not 100% convinced that this is a 2023.9 issue

I can confirm this is NOT a 2023.9 issue.

I was running 2023.8.4 and this intermittently stop working during the past few hours. I figured there was a core change so I updated to 2023.9 and it still doesn’t work.

I am having the same issue after installing 2023.09.0. Then i went back to the previous installation Home Assistant 2023.8.4 Supervisor 2023.08.3 Operating System 10.5 Frontend 20230802.1 - latest It was working on this but no longer.

As am I.

Please, please… stop posting unless you really have something useful to add.

While I appreciate the work your doing on trying to provide a fix, as I personally stated on your other PR I dont believe it resolved the underlying issue which is unrelated to user agents. I think work/investment needs to go into the root cause as to why this seems to be broken only on HA and not other systems.

Seeing as how messing with user agents is what fixes the issue for most, and I’m fairly certain the ones it didn’t work for are simply doing it wrong, I’m curious what makes you say this.

Further, what “other systems” are you referring to which aren’t breaking?

While I can understand wanting to assume this is a magical fix that works, trying to blame others and claim that we are just doing it wrong is just inherent confirmation basis by you. Id repeatedly offered to provide anyone any logs, testing, or evidence to show Ive tried this user agent change and it simply does not work. While I am not saying it doesnt resolve the issue for some, the fact that it doesnt resolve the issue for everyone strongly implies its not the root cause. As for your second question about other systems you can refer to this post where its stated only HA is experiencing issues, arraylabs/pymyq#182 (comment) Edit: Credit to @jeffgeorge beating me to the post about “other systems”

It is easy to verify that the core issue is the user agent, just use a tool like Postman or Insomnia to test the API calls.

If you or anyone else are still having issues, it is simply user error. You need to learn to accept that.

Does someone have a postman request they would like me to try? I will gladly do so and post the results.

Ive been active on both this thread and the other because the UA fix does not resolve it for me. Trust me if it was that simple and did fix it for me, Id be pushing for this to be merged. In the other thread you can even see I attempted the patch and posted results of a few terminal commands to “prove” it didnt resolve the issue.

Trying to claim simply adding a user agent fixes the issue when again there are other projects doing the same requests(with no user agent), and they are working flawlessly, and users who have applied this so called fix and it simply does not work, is just a total lie.

Again I will offer to test anything youd like, run any non malicious command on my machine, etc… And provide whatever “proof” youd like that this fix does not work for me. I have no reason to not want this fixed, and get no benefit out of having this broken for my own HA instance for weeks

While I appreciate the work your doing on trying to provide a fix, as I personally stated on your other PR I dont believe it resolved the underlying issue which is unrelated to user agents. I think work/investment needs to go into the root cause as to why this seems to be broken only on HA and not other systems.

Seeing as how messing with user agents is what fixes the issue for most, and I’m fairly certain the ones it didn’t work for are simply doing it wrong, I’m curious what makes you say this.

Further, what “other systems” are you referring to which aren’t breaking?

While I can understand wanting to assume this is a magical fix that works, trying to blame others and claim that we are just doing it wrong is just inherent confirmation basis by you. Id repeatedly offered to provide anyone any logs, testing, or evidence to show Ive tried this user agent change and it simply does not work.

While I am not saying it doesnt resolve the issue for some, the fact that it doesnt resolve the issue for everyone strongly implies its not the root cause.

As for your second question about other systems you can refer to this post where its stated only HA is experiencing issues, https://github.com/arraylabs/pymyq/pull/182#issuecomment-1719870223

Edit: Credit to @jeffgeorge beating me to the post about “other systems”

It is easy to verify that the core issue is the user agent, just use a tool like Postman or Insomnia to test the API calls.

If you or anyone else are still having issues, it is simply user error. You need to learn to accept that.

This is also resolved for meSent from my iPhoneOn Sep 26, 2023, at 12:19 PM, starsoccer @.***> wrote:

While I appreciate the work your doing on trying to provide a fix, as I personally stated on your other PR I dont believe it resolved the underlying issue which is unrelated to user agents. I think work/investment needs to go into the root cause as to why this seems to be broken only on HA and not other systems.

Seeing as how messing with user agents is what fixes the issue for most, and I’m fairly certain the ones it didn’t work for are simply doing it wrong, I’m curious what makes you say this. Further, what “other systems” are you referring to which aren’t breaking?

While I can understand wanting to assume this is a magical fix that works, trying to blame others and claim that we are just doing it wrong is just inherent confirmation basis by you. Id repeatedly offered to provide anyone any logs, testing, or evidence to show Ive tried this user agent change and it simply does not work. While I am not saying it doesnt resolve the issue for some, the fact that it doesnt resolve the issue for everyone strongly implies its not the root cause. As for your second question about other systems you can refer to this post where its stated only HA is experiencing issues, arraylabs/pymyq#182 (comment)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

hjdhjd/myq is the de facto f/oss reference implementation of the MyQ API. It explicitly does not require a user agent to be set and is currently working in HomeBridge. Furthermore, the developer has warned – in this comment thread! – that setting a user agent may lead to future discrimination by the MyQ API.

Edit: There may have been further off-github discussions that indicate this might be ok, but I can only go by what’s been stated publicly.

While I appreciate the work your doing on trying to provide a fix, as I personally stated on your other PR I dont believe it resolved the underlying issue which is unrelated to user agents. I think work/investment needs to go into the root cause as to why this seems to be broken only on HA and not other systems.

Seeing as how messing with user agents is what fixes the issue for most, and I’m fairly certain the ones it didn’t work for are simply doing it wrong, I’m curious what makes you say this.

Further, what “other systems” are you referring to which aren’t breaking?

Unfortunately, it seems like the current maintainers of this integration have been unavailable, since there has been no response and this integration has a large number of users with problems, I have created a new github organization to host a python-myq repository. This allows users who own a device to fix a problem when it pops up.

The Problem

There have been multiple arguments over what the problem actually is, here’s what I can say for sure:

1. MyQ was having problems with their servers and has had a lot of down time the past few weeks

2. MyQ was returning a 403 error, and when the 403 error was received, a user agent was supposed to be created, but it wasn't.

3. Some users had success just by changing what url they connected to myq with

My solution

I originally made sure that a user agent was always created, but due to advice from the developer of a myq implementation for a different programming language, I decided to make it only update the user agent when it fails. This is the best of both worlds, as if having a blank user agent works in the future, then nothing will change, but if it continues to not work, then a user agent will be created.

In reality, this should also cycle through the possible urls when you fail to connect, but that is not included in my change.

Going forward

I will do my best to fix some bugs, improve some things in the integration, etc. But I do not own a myq device. We need someone with python programming experience with a myq device to volunteer to take over maintaining the project. If you fit that description, I encourage you to reach out. I had done the annoying part of creating the organization, the repository, and setting up a workflow to automatically upload the code to pypi. I plan to improve some of the typing and potentially add in load balancing for the various urls. But outside of that, I am unable to test things as I do not own a device.

My goal is to include this new repository in the 2023.10 release - but that is not a certainty.

You can check out the new repository here: https://github.com/Python-MyQ/Python-MyQ and create any PRs/suggestions you may have. I encourage everyone who sees this message to limit commenting anything else on this thread, so that this message can have the highest visibility possible

While I appreciate the work your doing on trying to provide a fix, as I personally stated on your other PR I dont believe it resolved the underlying issue which is unrelated to user agents. I think work/investment needs to go into the root cause as to why this seems to be broken only on HA and not other systems.

I am happy to provide assistance with testing any possible solutions and even probably some high level technical advice, but I dont personally know python so wouldnt feel comfortable taking over any repository.

I have the same issue after updating to Home Assistant 2023.9.3 today

I am running the HA Docker container using Docker Compose, so these steps weren’t applicable (you can’t install Add-Ons with the container version). You can do the following instead:

  1. In your directory with your docker-compose.yml file:
wget https://raw.githubusercontent.com/Lash-L/pymyq/bbffeb911bb699d8b36a646ce5e1d7bcd9b96a93/pymyq/request.py
  1. Edit your docker-compose.yml file to mount the file by adding the following to your volumes: section:
- './request.py:/usr/local/lib/python3.11/site-packages/pymyq/request.py'`
  1. Recreate your container:
docker-compose up -d
  1. This will survive upgrades. Subscribe to this issue when it closes to know when you can remove the fix. Screenshot 2023-09-25 at 10 27 16 PM

I also lost this functionality. I deleted it thinking I could just relink it, and now it just fails to setup after accepting my creds.

Help!

Try these instructions.

For now, try to be patient, or consider switching to a garage door control system other than MyQ.

Would you happen to know of any decent free ones? I have a smart circuit board thing that connects through ewelink and connects to my Samsung smartthings (and supposedly Alexa and Google too) any way to put that into HA? Unfortunately that would o ly be control, no status of open vs closed.

I haven’t used it, but this one looks like an excellent option: https://paulwieland.github.io/ratgdo/

It retains a lot of the functionality, but makes it into a locally controlled system.

If you look at what the actual patch is doing, it’s changing the useragent that the pymq library uses to make http connections to the myq service. The myq folks seem to have implemented a useragent restriction, presumably to make things hard for third party libraries such as pymq. This is not a Home Assistant problem; it’s 100% myq/pymq.

For what it’s worth, what I’ve noticed is the fix works fine, even after multiple reboots. However, when HA gets updated for example today I updated Home Assistant Core to v2023.9.3 and rebooted, this broke the MyQ integration. Running the fix documented in this thread, and restarting HA, everything was working again. I’m no coder, but this tends me to think it is an HA issue, as opposed to a MyQ integration issue.

If you follow the instructions in this thread to directly patch the file in /usr/local/lib, then the patch will be lost everytime you update HA. If you follow these instructions instead, the patch will persist across HA updates.

There is no evidence that this is an HA core issue. It appears to either be an intermittent issue with the MyQ backend, or a problem with the pymyq library.

If this fix does work, can anyone running HA in an UnRAID docker advise how it could be applied? I’m not sure how I would get the ssh plugin going.

In unRAID use the UI to access the “Console” for the container or use the following command to access the the terminal of the container (no need for an SSH plugin): docker exec -it home-assistant /bin/sh

I have it working fine on an instance of homeassistant running Home Assistant 2023.5.4. I am having trouble setting up a fresh instance with the same integration on Home Assistant 2023.9.2 with the same garage opener

Looks to me like the update broke the integration

Hooked on phonics, worked for me

I was able to disable the integration for about 6 hours. After re-enabling it worked! I’m guessing the repeated attempts continues to block your account, so disabling to let the block clear may be necessary to allow the authentication to be successful.

…and it’s failing again.

I have just reloaded mine and it is still failing to setup. I am in US East region. For those working - what region are you in?

I keep getting:

On 9/11/2023 3:08:55 PM, Mark @.***> wrote: could someone dumb this down for me so i can get this working again

If you’re using the Samba addon you can do this instead of ssh:

  1. Download https://github.com/Lash-L/pymyq/archive/refs/heads/useragent_fix.zip somewhere temporary
  2. Drap the pymyq folder inside the zip to \your_samba_share_HA\config
  3. Restart HA

Yay! Thank you.

Can you link the PR here? I don’t see it in the list of open PRs for this repo.

Here is the PR: https://github.com/arraylabs/pymyq/pull/182

The PR is for the pymyq library, which this integration uses.

This is the easiest solution/workaround for now: #99947 (comment)

True, but can we all agree that MyQ stinks

MyQ has been practically flawless for me, I like it and hope we can get this interface restored.

Here’s to a resolution that lasts through the updates.

This resolution will last through updates.

I can confirm that this worked for me on two HA installations that I manage with MyQ… Some of my notes:

  1. Install the advanced SSH and web terminal addon, found here - https://github.com/hassio-addons/addon-ssh/blob/main/ssh/DOCS.md
  2. Set a username and password in the config of the addon, and disable protection mode.
  3. Start or restart the addon
  4. SSH using the webui for the addon in Home Assitant, or using your ssh client enter the following commands into your SSH terminal:
  5. paste this (without quotes) into the ui “docker exec -it homeassistant bash”
  6. paste this (without quotes) into the ui “cd /usr/local/lib/python3.11/site-packages/pymyq/”
  7. paste this (without quotes) into the ui “cp request.py request_bup.py”
  8. paste this (without quotes) into the ui “vi request.py”
  9. you will see a bunch of code to edit… hit the key “i” to enter insert mode
  10. Use your arrow keys to go modify line 34
  11. Change (without quotes) “self._useragent = None” to “self._useragent = str(“myq-ios-5.240.0.38162”)”
  12. arrow down to the end of the file
  13. hit the ESC key to close it
  14. type (without quotes) “:wq” this will close and save
  15. you should see the main screen again
  16. restart HA
  17. verify that MyQ loads

It works for those of you running HA in Docker. 😉 Wow, I had major doubts, but on my raspberry pi running supervised, it seemed to work fine as well! I did make a copy of the modified so hopefully it’s even easier if I need it again, should be able to just make a script that uses scp to put the file right in. Wayne

Think i will switch to the Konnected garaage door opener - all open

Think i will switch to the Konnected garage door opener - all open

I can confirm that this worked for me on two HA installations that I manage with MyQ… Some of my notes:

  1. Install the advanced SSH and web terminal addon, found here - https://github.com/hassio-addons/addon-ssh/blob/main/ssh/DOCS.md
  2. Set a username and password in the config of the addon, and disable protection mode.
  3. Start or restart the addon
  4. SSH using the webui for the addon in Home Assitant, or using your ssh client enter the following commands into your SSH terminal:
  5. paste this (without quotes) into the ui “docker exec -it homeassistant bash”
  6. paste this (without quotes) into the ui “cd /usr/local/lib/python3.11/site-packages/pymyq/”
  7. paste this (without quotes) into the ui “cp request.py request_bup.py”
  8. paste this (without quotes) into the ui “vi request.py”
  9. you will see a bunch of code to edit… hit the key “i” to enter insert mode
  10. Use your arrow keys to go modify line 34
  11. Change (without quotes) “self._useragent = None” to “self._useragent = str(“myq-ios-5.240.0.38162”)”
  12. arrow down to the end of the file
  13. hit the ESC key to close it
  14. type (without quotes) “:wq” this will close and save
  15. you should see the main screen again
  16. restart HA
  17. verify that MyQ loads

It works for those of you running HA in Docker. 😉

Tried that but it seems to be getting cleared after reboot (HASS Docker Container)

I just don’t get it to work. image

I edited request.py and rebooted Home Assistant. MyQ still isn’t loading. I verified the changes have been saved, even after reboot. Some errors in the logs: 2023-09-10 11:17:17.490 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component homeassistant.components.myq File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:17.503 ERROR (MainThread) [homeassistant.setup] Setup failed for myq: Unable to import component: Exception importing homeassistant.components.myq File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" ImportError: Exception importing homeassistant.components.myq 2023-09-10 11:17:42.205 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:42.230 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration myq: Exception importing homeassistant.components.myq.config_flow 2023-09-10 11:17:42.242 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:42.264 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration myq: Exception importing homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in

You added an i at the beginning of the file. Looks like you pressed i twice. Edit the file again and remove the extra i at the very start.

That worked. Thank you so much!!

I edited request.py and rebooted Home Assistant. MyQ still isn’t loading. I verified the changes have been saved, even after reboot.

Some errors in the logs:

2023-09-10 11:17:17.490 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component homeassistant.components.myq File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:17.503 ERROR (MainThread) [homeassistant.setup] Setup failed for myq: Unable to import component: Exception importing homeassistant.components.myq File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" ImportError: Exception importing homeassistant.components.myq 2023-09-10 11:17:42.205 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:42.230 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration myq: Exception importing homeassistant.components.myq.config_flow 2023-09-10 11:17:42.242 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:42.264 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration myq: Exception importing homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in

You added an i at the beginning of the file. Looks like you pressed i twice. Edit the file again and remove the extra i at the very start.

I edited request.py and rebooted Home Assistant. MyQ still isn’t loading. I verified the changes have been saved, even after reboot.

Some errors in the logs:

2023-09-10 11:17:17.490 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component homeassistant.components.myq File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in <module> import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in <module> File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in <module> from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:17.503 ERROR (MainThread) [homeassistant.setup] Setup failed for myq: Unable to import component: Exception importing homeassistant.components.myq File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in <module> import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in <module> File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in <module> from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" ImportError: Exception importing homeassistant.components.myq 2023-09-10 11:17:42.205 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in <module> import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in <module> File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in <module> from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:42.230 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration myq: Exception importing homeassistant.components.myq.config_flow 2023-09-10 11:17:42.242 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in <module> import pymyq File “/usr/local/lib/python3.11/site-packages/pymyq/init.py”, line 2, in <module> File “/usr/local/lib/python3.11/site-packages/pymyq/api.py”, line 28, in <module> from .request import REQUEST_METHODS, MyQRequest File “/usr/local/lib/python3.11/site-packages/pymyq/request.py”, line 1 i"““Handle requests to MyQ.””" 2023-09-10 11:17:42.264 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration myq: Exception importing homeassistant.components.myq.config_flow File “/usr/src/homeassistant/homeassistant/components/myq/init.py”, line 7, in <module>

Maybe that is why it does not work for me on my Yellow Box. What should I do instead ? On 9/10/2023 10:01:45 AM, nmelanson75 @.> wrote: Folks the Docker command is only if you are running it in Docker vs. on a Home Assistant Yellow or VM in VMware. This directory does not exist in Home Assistant Yellow, does anyone know how to fix this outside of Docker instances? — Reply to this email directly, view it on GitHub [https://github.com/home-assistant/core/issues/99947#issuecomment-1712822649], or unsubscribe [https://github.com/notifications/unsubscribe-auth/AHI6JKBSN76UX7JPB5WYQ2TXZXB4RANCNFSM6AAAAAA4QV5STU]. You are receiving this because you were mentioned.Message ID: @.>

@Am0din, running this docker command first to access the referenced directory/file is required in ALL installation types (HAOS, VM, Yellow etc.) and is not only for HA on docker: “docker exec -it homeassistant bash”

Yeah, doesn’t even work for me trying to get this on the first line of my HA in Terminal, so I’ll have to wait for a fix, or just remove this from my HA altogether and go back to the app. I’ll work around it to not rely on it.

@Am0din, you need to use the “Advanced SSH & Web Terminal” add-on with “Protection Mode” disabled. It will NOT work with the “Terminal & SSH” add-on.

Thank you for this, I am all up and running again.

@Am0din, running this docker command first to access the referenced directory/file is required in ALL installation types (HAOS, VM, Yellow etc.) and is not only for HA on docker:

“docker exec -it homeassistant bash”

Yeah, doesn’t even work for me trying to get this on the first line of my HA in Terminal, so I’ll have to wait for a fix, or just remove this from my HA altogether and go back to the app. I’ll work around it to not rely on it.

@Am0din, you need to use the “Advanced SSH & Web Terminal” add-on with “Protection Mode” disabled. It will NOT work with the “Terminal & SSH” add-on.

Folks the Docker command is only if you are running it in Docker vs. on a Home Assistant Yellow or VM in VMware. This directory does not exist in Home Assistant Yellow, does anyone know how to fix this outside of Docker instances?

Worked for me !!

cd /usr/local/lib/python3.11/site-packages/pymyq/
cp request.py request_bup.py
vi request.py
i to enter insert mode
Modify line 34

    Was self._useragent = None
    Is self._useragent = str("anytexthere")

Thank you - this should probably be in the top post at this point - as others have said the “solution” is now hidden by other comments.

I removed the extraneous ```, added a more realistic user agent myq-ios-5.240.0.38162 and restarted homeassistant…

You have no clue what you’re talking about, just stop.

Home assistant isn’t sending a user agent and the lack of one is being blocked. If people are going to continue to reply here please at least read the comments that are already here…

There is no need to imply that I’m an incompetent and illiterate idiot. There are over 200 comments, several of which citing code that appears to pull from https://raw.githubusercontent.com/arraylabs/pymyq/master/.USER_AGENT to determine a UA string to send, and I apologize for not reading the code thoroughly enough to see what the normal result of that is, and I admit that I am not fluent with Python. Before your rant, someone else had already politely corrected me.

My point I meant to make with with my assumption that HA was blacklisted was that it is not unexpected for any fixes to stop working as they may eventually switch to a short whitelist once they’ve gotten all their approved paid integrations straightened out for it. As far as I’m aware, Chamberlain themselves never advertised Home Assistant compatibility, and the fact that this ever worked at all could very well have been an unintentional oversight they’re in the process of permanently correcting. In that case, the HA integration may eventually be retired as others with API restrictions or closures have been.

If anyone is having trouble with the Escape key, you can use Shift + [ instead. Also typing :wq will save and close the file in one single command.

It would appear that Chamberlian are now rejecting logons from home assistant as of about 2-3 hours ago.

It was working after the fix, then all of a sudden it started rejecting the password

Seriously, what is wrong with these people

On Sun, 10 Sept 2023 at 06:00, David Rothenberger @.***> wrote:

I went from 2023.8.4 to 2023.9.1 and still have the same issue 😦

#99947 (comment) https://github.com/home-assistant/core/issues/99947#issuecomment-1712572456 #99947 (comment) https://github.com/home-assistant/core/issues/99947#issuecomment-1712575676

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/99947#issuecomment-1712589845, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADUVUJ3FRZFD5XYHE46MLDXZTDELANCNFSM6AAAAAA4QV5STU . You are receiving this because you commented.Message ID: @.***>

– Kind Regards

Stephen Cooper 0424800104

I called the MyQ support staff today and they said the recently made changes to their app and servers, and that they do not recognize Home Assistant as a valid partner. They recommended I switch to IFTTT or Alarm.com as those partners have a supported status. This bites.

Not surprising considering random nonsense UAs are being accepted, that indicates this integration was intentionally blacklisted.

I can’t be too mad since I’ve gotten I think almost two years of free API access they apparently didn’t intend on a $15 Black Friday purchase. But I’m moderately mad, and I feel for anyone who bought an actual full-fledged smart garage door opener. I’m gonna keep spoofing my UA as long as that continues to work though.

Edit: After updating my image to latest, I have set my UA to “I_disapprove_of_this_descision,_Chamberlain”

still not happening. did i unzip the file to the wrong spot? i was in config, i would have thought that is where it would have gone. Screenshot 2023-09-09 120618

In the original instructions, I had you “cd config” first, then run the commands. To try again, first do “cd config”, then do “ls” to see the contents of the directory. Then, clean up any remnants from previous tries. Look for useragent_fix and pymyq files/folders, and remove them all with appropriate “rm -fr” commands. Then, run the rest of the commands from my post.

so found that dir using the LS command, (i was actually trying “dir” to see what was in config and getting annoyed I didn’t know the right command to see the directory , thanks for that old DOS commands coming back into my head here)

I was able to remove it by leaving the “Config/” off your original remove command,

went thru the steps from the OP again and unfortunately it still fails with the move command as it originally did.

Screenshot 2023-09-09 115625

Start by cleaning up from your previous attempts.

rm -fr config/useragent_fix* config/pymyq*

Then try the commands again.

still not happening. did i unzip the file to the wrong spot? i was in config, i would have thought that is where it would have gone.

Screenshot 2023-09-09 120618

It’s time to bid farewell to MyQ cloud. Just two days ago, I started using ratgdo, and it’s been fantastic. I now have complete control over my MyQ garage door opener, sensors, and lights without relying on MyQ cloud. A heartfelt thanks to all the developers who made MyQ cloud available to us over the past few years.

I want to clarify that I’m not affiliated with ratgdo, nor am I attempting to endorse it. I’m simply sharing an alternative for my fellow Hass users.

so i go to the MV command to move the file and i get a list of - commands from busy box? and it doesn’t look like it’s actually making the move is there a bit missing in that line in your original reply?

Are you including the . at the end of that line?

I fi do that I get can’t rename “.” no such file, … honestly thought that . was a typo

Those commands work for me in the regular and Advanced terminal add-ons. Please post the exact commands you’re running and the responses you’re seeing.

Screenshot 2023-09-09 115625

so i go to the MV command to move the file and i get a list of - commands from busy box? and it doesn’t look like it’s actually making the move is there a bit missing in that line in your original reply?

Are you including the . at the end of that line?

I fi do that I get can’t rename “.” no such file, … honestly thought that . was a typo

Why doesn’t someone just fix the integration?

We should be respectful of those doing work for free \ as a hobby, unless you’re planning on paying him. Alternatively you can be that “someone”.

excuse me being a noob but I have tried what was posted above in the terminal and I get errors right off the bat that the files aren’t there and it can find the directories, am i doing something wrong? I’m not much a code person so I see posts like this but don’t know what to do with them,. I also tried BkTotten’s post of making the file in the config dir and still nothing.

could someone dumb this down for me so i can get this working again

Thanks.

The operation requires some knowledge of working with docker, specifically accessing a container. To get there, the Advanced SSH & Web Terminal Addon must be installed into Home Assistant in order to access. The standard terminal will not allow the docker commands and the reason why you are having trouble.

Once you have the above addon install and accessing it, then the docker command issued within that terminal will gain access into the homeassistant container. the command: [docker -it homeassistant bash] is what gets you there.

Now, in order to place the files into home assistant to begin with, the Samba Share addon must be installed and configured in order to share the /config folder from home assistant. Then you are able to map a drive from Windows to the Config folder in Home assistant. Once the files are placed, then you can do the above to get to files and copy them.

This is not something that can be dumbed down too much, but once you understand by doing, then you will understand how to do more troubleshooting in home assistant and docker.

excuse me being a noob but I have tried what was posted above in the terminal and I get errors right off the bat that the files aren’t there and it can find the directories, am i doing something wrong? I’m not much a code person so I see posts like this but don’t know what to do with them,. I also tried BkTotten’s post of making the file in the config dir and still nothing.

could someone dumb this down for me so i can get this working again

Thanks.

So where would this file be on a Home Assistant Yellow?

So I was able to implement the workaround once I realized that the docker command is still required for the Home Assistant Yellow platform. For Yellow at least, you WILL have the “/usr/local/lib/” path before running the docker command, but you will not see what you expect to see there because you aren’t actually in the container yet.

This worked for me.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

This worked perfect. Thank you!

I’m not a coding guy, how do I input the code? I’ve got the SSH and Terminal.

I am also surprised to see a lot of comments here with a solution and nobody made a PR to the original library yet.

@joostlek interesting. I stand corrected. Thanks for the reference.

@brg468 Yes it is. You’re calling get_clientsession. Check this comment out for more context https://github.com/home-assistant/core/pull/97541#discussion_r1279830428

Instead of modifying the pymyq plugin it’s probbly better to modify the myq websession in home assistant. This may work but is untested. If I understood how to test this code I would just submit a pull request.

FILE: /core/blob/dev/homeassistant/components/myq/init.p

Current:

    websession = aiohttp_client.async_get_clientsession(hass)
    conf = entry.data

Modified

    websession = aiohttp_client.async_get_clientsession(hass)
    websession["headers"] = {"useragent": "Home Assistant"}
    conf = entry.data

I am running HA on UnRaid using the linuxserver image - if anyone else is doing the same, the location of the file you need to modify is different than above.

Origianl location

/usr/local/lib/python3.11/site-packages/pymyq/

Actual Location

/lsiopy/lib/python3.11/site-packages/pymyq/

Otherwise just open an unraid terminal and follow these instructions (assuming you left the container called ‘homeassistant’ -if not, change it to the container name in the first command)

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("HA_Auto")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

Best place to do this in HA terminal or putty?

I just did it through the “Advanced SSH & Web Terminal” addon’s web ui

@rsissons

I don’t see this in my ha on a pi3 core/supervisor install. Where would I find it? usr/local/lib/python3.11/site-packages/pymyq On Fri, Sep 8, 2023, 6:02 PM bigmak40 @.> wrote: Thanks @lygris https://github.com/lygris, that did work. - docker exec -it homeassistant bash - cd /usr/local/lib/python3.11/site-packages/pymyq/ - cp request.py request_bup.py - vi request.py - i to enter insert mode - Modify line 34 – Was self._useragent = None – Is 'self.useragent = str(“anytexthere”)` - Esc key to exit insert mode - :w + enter to write the changes - :x + enter to exit VI - Restart Home Assistant — Reply to this email directly, view it on GitHub <#99947 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOOM44K4AJJLTNVCNVB6ETXZO54DANCNFSM6AAAAAA4QV5STU . You are receiving this because you commented.Message ID: @.>

I have a barebones/ supervised install I assume you need to do what I did. ssh in

sudo su (not sure if it matters but I did it) docker exec -it homeassistant /bin/bash (this will kick you to homeassistant:/config# from there we cd in next step) homeassistant:/config# cd /usr/local/lib/python3.11/site-packages/pymyq and the rest of the steps worked just fine…

Thanks @lygris, that did work.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

Same error

Thanks @lygris, that did work.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

This works for me

@bdb12 Yes, you will have to re-apply the fix anytime you update Home Assistant until a fix for this is in the change log 😃

Well at least it’s not me. I am having the problem as well. Was having a very similar issue on the SmartThings side with the BrBeard integration there.

I just migrated my garage door over to HA yesterday because of the BrBeard issues. Well, it worked great for a day. Lol

Thanks @lygris, that did work.

  • docker exec -it homeassistant bash

  • cd /usr/local/lib/python3.11/site-packages/pymyq/

  • cp request.py request_bup.py

  • vi request.py

  • i to enter insert mode

  • Modify line 34

    • Was self._useragent = None
    • Is self._useragent = str("anytexthere")
  • Esc key to exit insert mode

  • :w + enter to write the changes

  • :x + enter to exit VI

  • Restart Home Assistant

For those using a LXC in proxmox the request.py file is in: ./srv/homeassistant/lib/python3.11/site-packages/pymyq/

They are probably using the cloudflare waf to block the user string…If it was dynamic what would it be? It may get flagged as bot traffic and get blocked other places like Akamai, Imperva etc. I’m guessing the block is in my q’s own policy.

Perhaps a standard browser user agent string for my q only if possible. Or a user string my q expects to see so the traffic is under the radar.


From: brendandixon @.> Sent: Friday, September 8, 2023 5:54:45 PM To: home-assistant/core @.> Cc: David Boyden @.>; Comment @.> Subject: Re: [home-assistant/core] MyQ: 403 forbidden (Issue #99947)

@ceddy441https://github.com/ceddy441 is (again) correct: We should expose the UA as a configuration variable (initially filled with a dynamic string). As long as the API exists and the strings remain pattern-free (e.g., not all UUIDs), it will work fine.

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/99947#issuecomment-1712266348, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH2MCFCQ35MNOE65Z3RYIY3XZOH2BANCNFSM6AAAAAA4QV5STU. You are receiving this because you commented.Message ID: @.***>

I’d like to mention that, within the Home Assistant (HA) logs, there is evidence of successful login and authentication token retrieval. This suggests that there may not be any IP blocking implemented. However, I am still in the process of understanding why Postman functions correctly while HA does not simultaneously.

Interesting, although I can still call the same APIs and fetch the devices manually. CleanShot 2023-09-08 at 13 03 24

I don’t think it’s base version related. Mine stopped working on a reboot while I was doing some work; I think restarting knocks you offline, not the upgrade.

I upgraded a few days ago and it worked fine. I had to restart to update something else and after restarting today, it no longer works.