Chamberlain MyQ Binding

@digitaldan

I figured why my bridge wasn’t connecting or why it would connect and flap.

I’m one of the few that have over 5 MyQ items (1 GDO, 5 lamp units and 7 switches)
Once I have 5 or more items added to my account the bridge becomes unstable. Once all items are added it won’t connect at all.

I can provide logs. I had debug turned on but I couldn’t see anything obvious. All I could gather was it didn’t really like it when it was getting the list of items but I couldn’t see the error message just that was retrying and that’s what lead me to remove items from my accounts to test.

My bridge operation has been incredibly spotty. I’ll download the daily build, get the bundles operating and all seems fine, then again this morning I’m back to the same “ERROR:COMM” status on my bridge thing.
The log error however is down to a single line now:

2021-09-19 09:25:29.351 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'myq:account:home' updated: OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 : 

Unsure what his happening to make the binding so continuously unstable? Is it something Chamberain is doing on their end?
***update: And now, as soon as I type this and hit save, the thing is working again, then off again?!?

This from the DEBUG files:

2021-09-19 09:38:30.451 [DEBUG] [q.internal.handler.MyQAccountHandler] - MyQ communication error
org.openhab.binding.myq.internal.handler.MyQAccountHandler$MyQCommunicationException: Invalid Response Code 0 : 
	at org.openhab.binding.myq.internal.handler.MyQAccountHandler.parseResultAndUpdateStatus(MyQAccountHandler.java:435) ~[?:?]
	at org.openhab.binding.myq.internal.handler.MyQAccountHandler.getDevices(MyQAccountHandler.java:349) ~[?:?]
	at org.openhab.binding.myq.internal.handler.MyQAccountHandler.fetchData(MyQAccountHandler.java:271) ~[?:?]
	at org.openhab.binding.myq.internal.handler.MyQAccountHandler.normalPoll(MyQAccountHandler.java:259) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]
1 Like

I’m having a similar problem.
It gets increasingly unstable the more items I have on my MyQ account, even if I don’t add them as things.

My debug shows something similar.

@digitaldan
EDIT:
Did some more testing.
Basically I can’t have more than 4 MyQ devices added to the account or the binding will fail to connect or refresh the token.

The number of things don’t seem to matter.

Running OH3.2 snapshot build 2499

Binding is 3.2.0.20210918623
Jsoup 1.8.3

Hmm, an http response should never be 0, thats very odd, I’m not sure how that can be, i would think the Jetty HTTP client would not even allow that. I’ll take a look and see if my logs show something similar.

Since it’s a general communication error, we only mark the binding offline, but will still continue to try and poll every 60 seconds ( or lower if configured) , so it sounds like the next poll worked. It would be helpful to know from your logs the pattern of off and online. I guess its possible this is MyQ throttling requests, but again the 0 response code is suspicious.

So we don’t poll any differently due to number of devices, nor does the number devices have anything to do with the token. I’m not sure how yet that would cause issues.

It would be helpful to have debug logs (and possibly trace as well) as this does not sound like the other issue yet. Also can you let me know how you have this configured (through the UI or thing files)?

Hi Dan

Everything is done in UI. I’m starting from scratch trying to redesign everything on the new OH3 Paradigm. Trying to do away with the cfg files.

I have a tracelog where the binding is the only one running. In the process I started 4 MyQ items on my Account. Then I added a 5th and during the next refresh for a token the Bridge fails to the error below.
I then remove the 5th item from my account without making any changes to OH3 and during the next refresh it get the token and it’s working fine.

[INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'myq:account:home' updated: OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :

Where should I send the log to?

I set the log to DEBUG, stopped then restarted the bundle. Here’s what logged:

2021-09-19 20:38:00.623 [DEBUG] [q.internal.handler.MyQAccountHandler] - Login Code 200 Response <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
    <title>MyQ Security</title>
    <link rel="stylesheet" href="/Styles/Reset.css" />
    <link rel="stylesheet" href="/Styles/FontAwesome.css" />
    <link rel="stylesheet" href="/Styles/SelectInput.css" />
    <link rel="stylesheet" href="/Styles/Site.css" />
    <link rel="stylesheet" href="/Styles/automotiveConsent.css" />
    <link rel="icon" type="image/png" href="/favicon-32x32.png" />
<script type="text/javascript">
//<![CDATA[
window["_tsbp_"] = { ba : "X-TS-BP-Action", bh : "X-TS-AJAX-Request"};
//]]>
</script><script type="text/javascript" src="/TSbd/0830cd8dbfab20007dbbb921b3465235e10d6eca5a5a073aa36d044fdf7d5eae9370095178eb7ee3?type=2"></script></head>
<body>
    

<div class="container body-content">
    <div class="standard-page">
        <div class="logo"></div>
        <div class="title">Sign In</div>
<form action="/api/Account/LoginWithEmail?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DIOS_CGI_MYQ%26code_challenge%3DZ3P5NND1PElQbGCFmgpHtgxJFvtG_YEMfJOMxPx-K0g%26code_challenge_method%3DS256%26redirect_uri%3Dcom.myqops%253A%252F%252Fios%26response_type%3Dcode%26scope%3DMyQ_Residential%2520offline_access" method="post"><input id="ReturnUrl" name="ReturnUrl" type="hidden" value="/connect/authorize/callback?client_id=IOS_CGI_MYQ&amp;code_challenge=Z3P5NND1PElQbGCFmgpHtgxJFvtG_YEMfJOMxPx-K0g&amp;code_challenge_method=S256&amp;redirect_uri=com.myqops%3A%2F%2Fios&amp;response_type=code&amp;scope=MyQ_Residential%20offline_access" />            <div class="form-fields">
                <input type="email" class="form-control email" placeholder="Email" autofocus autocomplete="false" data-val="true" data-val-required="The email field is required." id="Email" name="Email" value="" />
                <input type="password" class="form-control" placeholder="Password" autocomplete="false" data-val="true" data-val-required="The password is required." id="Password" name="Password" />
                
                <div class="validation-summary-valid" data-valmsg-summary="true" id="validation-errors"><ul><li style="display:none"></li>
</ul></div>
                <input type="submit" id="btn-signin" class="btn btn-default" value="Sign In" />
                <div class="forgot-password">
                    <a href="/api/Account/ForgotPassword?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DIOS_CGI_MYQ%26code_challenge%3DZ3P5NND1PElQbGCFmgpHtgxJFvtG_YEMfJOMxPx-K0g%26code_challenge_method%3DS256%26redirect_uri%3Dcom.myqops%253A%252F%252Fios%26response_type%3Dcode%26scope%3DMyQ_Residential%2520offline_access" class="link">
                        <span>
                            Forgot Password
                        </span>
                        <i class="fa fa-angle-right" aria-hidden="true"></i>
                    </a>
                </div>
            </div>
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8IET59l0am5LrkJTS_9dHDfPtlEQY17Yddie4X4d3SM3nfn12woI6ZTYrzxkqXP6zAbRhK-heQYFQ8tTv26vyVP5RNcWvRAagUKSMfLXEE8Cma2XqnhJoqHeh82a3LzuXUwT6qZM1-Ta6r-1oNIG85s" /></form>    </div>
</div>



<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.0.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.16.0/jquery.validate.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"></script>
<script src="/Scripts/iPhoneXFix.js"></script>



</body>
</html>
2021-09-19 20:38:00.628 [DEBUG] [q.internal.handler.MyQAccountHandler] - Posting Login to https://partner-identity.myq-cloud.com/api/Account/LoginWithEmail?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DIOS_CGI_MYQ%26code_challenge%3DZ3P5NND1PElQbGCFmgpHtgxJFvtG_YEMfJOMxPx-K0g%26code_challenge_method%3DS256%26redirect_uri%3Dcom.myqops%253A%252F%252Fios%26response_type%3Dcode%26scope%3DMyQ_Residential%2520offline_access
2021-09-19 20:38:00.926 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'myq:account:home' updated: ONLINE
2021-09-19 20:38:00.927 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from UNKNOWN to ONLINE
2021-09-19 20:38:01.124 [DEBUG] [q.internal.handler.MyQAccountHandler] - Auth Token Refreshed, expires in 3600
2021-09-19 20:38:01.894 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'myq:garagedoor:home:cg286348ceb3' updated: ONLINE
2021-09-19 20:38:01.895 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:garagedoor:home:cg286348ceb3' changed from UNKNOWN to ONLINE
2021-09-19 20:38:01.895 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'garage_door_status' updated to closed
2021-09-19 20:38:01.896 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'garage_door_switch' updated to OFF
2021-09-19 20:38:01.896 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'garage_door_rs' updated to DOWN
2021-09-19 20:38:01.896 [INFO ] [openhab.event.ThingStatusInfoEvent  ] - Thing 'myq:garagedoor:home:cg286348c683' updated: ONLINE
2021-09-19 20:38:01.897 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:garagedoor:home:cg286348c683' changed from UNKNOWN to ONLINE
2021-09-19 20:38:01.897 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'shop_door_south_status' updated to closed
2021-09-19 20:38:01.897 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'shop_door_south_switch' updated to OFF
2021-09-19 20:38:01.897 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'shop_door_south_rs' updated to DOWN

Please PM it to me. I’m still not sure that the number of things or items is really at play, or if its just a coincidence, there is no relationship to items and the logic of this binding that would cause that afaik.

That error has nothing todo with getting a token, its being thrown trying to the general device API.

Thanks, thats all normal, and your MyQ things should be online. What i was hoping is if you could send logs when it fails. But actually, i can see this in my logs too. It seems to have happened a few times starting on the 14th (see logs below)

If it does happen, and stays offline for more than a min (so does not come back on the next poll), please PM me the relevant logs. I’ll see about catching this error specifically and recovering from it quicker in the mean time. It has not happened today, so this seems fairly random on my system.

2021-09-09 20:36:56.043 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :
2021-09-09 20:37:26.284 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :  to ONLINE
2021-09-14 23:40:10.660 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 503 : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
2021-09-14 23:40:41.121 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 503 : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
2021-09-15 22:04:29.399 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :
2021-09-15 22:04:59.696 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :  to ONLINE
2021-09-16 02:10:32.678 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 503 : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
2021-09-16 02:11:12.679 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 503 : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
2021-09-16 02:15:03.132 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :  to ONLINE
2021-09-16 02:16:14.471 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :
2021-09-16 02:18:04.855 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :  to ONLINE
2021-09-16 02:19:14.978 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :
2021-09-16 02:20:25.366 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :  to ONLINE
2021-09-16 02:21:05.368 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :
2021-09-16 02:22:55.591 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'myq:account:home' changed from OFFLINE (COMMUNICATION_ERROR): Invalid Response Code 0 :  to ONLINE

Hello,

I just upgraded to 3.2 from 2.5, install the new binding and now I have this error when I create the bridge

Invalid Response Code 400 : { “SecurityToken”: “”, “ReturnCode”: “0”, “ErrorMessage”: “please contact customer care, supportID: 3927793507507441104”, “CorrelationId”: “” }

I believe you need to re-install the add-on per instructions above after upgrading, until it is merged with the code release code. I could be wrong about this, but reinstalling the the jar worked for me.

I’m assuming you mean the 3.2 snapshot build and not milestone? Can you post the build version? If it is the snapshot build, can you try pausing and starting the account thing from the UI and see if that helps? that will cause a new token to be requested. It sounds like there is an issue getting the token, which is odd since i would expect the error to happen earlier in the login process, and this error happens after that.

The code has been merged and is available in the 3.2 snapshot distribution.

Got it. I am on a milestone release (M2).

My bad, I’m on 3.1.0… I tough for sure I was on 3.2. I have the binding from the binding store in the ui.

Could it be a remnant from the old binding I had on 2.5?

No, there is a MyQ binding, but does not have the changes discussed here. See this post for the jar location, and scroll up a bit for instructions on how to install, or use the SNAPSHOT distro which has the right one already.

Ok, I installed the 3.2 snapshot with the dependancy. I manage to connect my account, was online, I created my garage door thing. The account jump a lot from online to COMMUNICATION_ERROR Invalid Response Code 0 or 1 and I have no status on the door (while it says online when both or online, else error_bridge)

My Guess and it’s a blind guess is Chamberlain has some kind of rate limiting going on.
It was encountered as far back as API v4. When the API would lock out accounts in a cooldown when a “Rapid poll” was executed and the account had more than 2 or 3 devices.

Can you tell me a detailed account of how you created your account and door things ? Also are you saying you get both a 0 and 1 response code? Can you copy the exact message please as 1 is not something yet seen. I just tried doing this in the UI (add account thing, go to inbox, scan, add all 3 newly discovered myq things, etc…) can’t seem to reproduce this.

I don’t think thats the case, for one i would expect a real response code, I have never seen 0 with any service since the dawn of time, and i’m not 100% certain its coming from MyQ. 0 is not a RFC allowed code, and modern web frameworks would make it difficult to use. I would expect a 429 error (too many requests) or any 4xx error, maybe even a 5xx error. Also i just tried opening and closing my garage door multiple times as well as closing multiple of them together (which should not make any difference, we only poll once for all of them) which triggered our rapid polling for over a minute ( we poll every 5 seconds for rapid) and did not get an error. If i can get it to happen regularly i can debug at our HTTP client level, but so far i can’t make it happen at will.

So a couple of updates. After lurking around other projects, it sounds like MyQ cloud ops has had a rough month stability wise and has been very flaky. The incidents in my logs line up with issues they had with their service that other projects also noted. I don’t think thats the whole issue, but obviously it looks very similar from our clients POV.

I’m going to assume this 0 response code is a bug in Jetty and that what we are seeing is the MyQ service prematurely closing our connection. Normally this is catchable, but jetty is not throwing it, and so the response code never gets set (and in java a unset int is 0). I think this happens both when MyQ may decide it doesn’t like your user agent anymore and when their service is randomly crashing. I have added a quick retry logic which both changes the useragent and then tries again to poll. We also generate a new useragent if we have to do a full login again.

You can find the jar on my repo , if you use the cli to update the current SNAPSHOT binding like: bundle:update org.openhab.binding.myq file:////some/path/org.openhab.binding.myq-3.2.0-SNAPSHOT.jar then you do not have to install jsoup (its already installed) , if you drop it in your addons folder, but have to uninstall the current one first, then you will need to install jsoup again.

I’m not that confident this will fix the issue here as i can’t seem to reproduce them, but lets see how it goes.

3 Likes

What I did is I added the gateway with my email and password. Then I added the garage door opener by entering the serial number.

The ui doesn’t show me the full error code, I copied what I was able to select.

Can you try following the instructions i posted in this thread to let the binding discover the devices automatically? See Chamberlain MyQ Binding - #745 by digitaldan . If that works, can you confirm if the serial number you have is the same that gets discovered?

1 Like