Chamberlain MyQ Binding

If it helps, here is the Fiddler capture for the app. If you want I can post the responses as well. let me know if the code is in Git and maybe I can try to contribute as well (I am more .net than java so no promises…)

  1. looks like login url is https://www.myliftmaster.com
  2. After login redirects to V5 here: https://www.myliftmaster.com/Dashboard?isV5=True
  3. Gets all Gateways in JSON format that has serial number of each device: https://www.myliftmaster.com/Gateway/GetAllGateways?_=1572532743772
  4. Gets detailed JSON for each device by brandname. even though what I bought was MYQ it says liftmaster here for my account https://www.myliftmaster.com/api/MyQDevices/GetAllDevices?brandName=Liftmaster
  5. Gets all event history based on account ID here: https://www.myliftmaster.com/api/MyQRules/evthist?acctId=xxx
  6. Gets all active rules here: https://www.myliftmaster.com/api/MyQRules/Rules
  7. Open / Close : https://www.myliftmaster.com/Device/TriggerStateChange?SerialNumber=XXX&attributename=desireddoorstate&attributevalue=0 we get response as {“errormessage”:""}
  8. Some of the headers captured from Fiddler
    Connection: keep-alive
    Cache-Control: max-age=0
    Upgrade-Insecure-Requests: 1
    DNT: 1
    User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36
    Sec-Fetch-Mode: navigate
    Sec-Fetch-User: ?1
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
    Sec-Fetch-Site: same-origin
    Referer: https://www.myliftmaster.com/
    Accept-Encoding: gzip, deflate, br
    Accept-Language: en-US,en;q=0.9
2 Likes

Thank you for helping out. i am available to test. It would be nice to get these garage doors working again with openhab.

I am also available to do testing

This may be a hint to fix the user agent issue.

Looks like it’s not important anymore. Just the appId is used?

1 Like

Can confirm that removing user agent fixes binding, but for some reason using device name no longer worked. I had to switch to device id.

I created a new 1.14 binding that works(I hope). I switched to the v5 API to maybe fix some of the issues people were having with the v5.1. It still throws an exception every time you send a command but it does work. I think its something with the return value. I also spent the weekend working on a 2.5 binding which I hope to have ready soon. Thank you for the patience.

Scott

4 Likes

‘Device Names’ from the MyQ app is working for me.

Appreciate it @scooter_seh . Looking forward to the 2.5 version. Let me know if there is anything i can do to help.

Thank you for all the work you are doing. Now, my error message switched to

no MyQ device found with deviceID: 0

I’m using device ID and still getting error. any ideas? My myq.cfg is just user and password… appid is commented. my password does have crazy characters and my device name does have spaces - but i’m not using it… any ideas appreciated

2019-11-06 07:10:49.301 [ERROR] [nhab.binding.myq.internal.MyqBinding] -     
Could not connect to MyQ service java.io.IOException: Request Failed: Unknown resonse
    at org.openhab.binding.myq.internal.MyqData.request(MyqData.java:289) ~[301:org.openhab.binding.myq:1.14.0.201911060339]
    at org.openhab.binding.myq.internal.MyqData.getMyqData(MyqData.java:123) ~[301:org.openhab.binding.myq:1.14.0.201911060339]
    at org.openhab.binding.myq.internal.MyqBinding.poll(MyqBinding.java:205) [301:org.openhab.binding.myq:1.14.0.201911060339]
    at org.openhab.binding.myq.internal.MyqBinding.access$0(MyqBinding.java:197) [301:org.openhab.binding.myq:1.14.0.201911060339]
    at org.openhab.binding.myq.internal.MyqBinding$1.run(MyqBinding.java:388) [301:org.openhab.binding.myq:1.14.0.201911060339]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]

You need to update your item file to use the serial number or device name from the MyQ app, not the index.

Weird character have been an issue in the past, try a simpler password and see if it fixes it. If so maybe PM me the characters you are using and I will try it with mine. Also turn on TRACE logging for more info.

1 Like

Thanks @scooter_seh!

Just updated the add-on and I’m still running into issues. Looks like the account endpoint URL used to access is not the same as provided by the service in its response.

I believe it expects http://api.myqdevice.com/api/v5/Accounts/(AccountId) instead of http://api.myqdevice.com/api/v5/Accounts/(UserId)

Hope the below trace helps.

2019-11-06 07:37:39.484 [TRACE] [enhab.binding.myq.internal.LoginData] - myq securityToken: XXXXXXXXXXXXXXXXXXXXXXXXX
2019-11-06 07:37:39.551 [TRACE] [openhab.binding.myq.internal.MyqData] - attempting to get acount
2019-11-06 07:37:39.554 [TRACE] [openhab.binding.myq.internal.MyqData] - Requesting URL https://api.myqdevice.com/api/v5/My/?expand=account
2019-11-06 07:37:39.807 [WARN ] [he.commons.httpclient.HttpMethodBase] - Cookie rejected: "$Version=0; TS01dfdd0d=01474093dcd36f8aaf24d44f713322e093ba1000de59053a4f699ca6868254e7995f3b550be7890c5d92c04f6c2b800f476fc90b60; $Path=/; $Domain=.api.myqdevice.com". Illegal domain attribute ".api.myqdevice.com". Domain of origin: "api.myqdevice.com"
2019-11-06 07:37:39.815 [TRACE] [openhab.binding.myq.internal.MyqData] - Received MyQ JSON: {"Users":{"href":"http://api.myqdevice.com/api/v5/My/Users"},"Admin":false,"Account":{"href":"http://api.myqdevice.com/api/v5/Accounts/dcaa5874-2d03-478e-beff-1786e7cd3f16","Id":"dcaa5874-2d03-478e-beff-1786e7cd3f16","Name":"XXXXXXXXXXXXXXXXXXXXXXXXX","Email":"XXXXXXXXXXXXXXXXXXXXXXXXX","Address":{"AddressLine1":"","AddressLine2":"","City":"","State":"","PostalCode":"XXXXXXXXXXXXXXXXXXXXXXXXX","Country":{"Code":"USA","IsEEACountry":false,"href":"http://api.myqdevice.com/api/v5/Countries/USA"}},"ContactName":"Jay M","DirectoryCodeLength":0,"UserAllowance":4,"TimeZone":"America/Chicago","Devices":{"href":"http://api.myqdevice.com/api/v5/Accounts/dcaa5874-2d03-478e-beff-1786e7cd3f16/Devices"},"Users":{"href":"http://api.myqdevice.com/api/v5/Accounts/dcaa5874-2d03-478e-beff-1786e7cd3f16/Users"},"AccessGroups":{"href":"http://api.myqdevice.com/api/v5/Accounts/dcaa5874-2d03-478e-beff-1786e7cd3f16/AccessGroups"},"Roles":{"href":"http://api.myqdevice.com/api/v5/Accounts/dcaa5874-2d03-478e-beff-1786e7cd3f16/Roles"},"AccessSchedules":{"href":"http://api.myqdevice.com/api/v5/Accounts/dcaa5874-2d03-478e-beff-1786e7cd3f16/AccessSchedules"},"Zones":{"href":"http://api.myqdevice.com/api/v5/Accounts/dcaa5874-2d03-478e-beff-1786e7cd3f16/Zones"}},"AnalyticsId":"4479ba65-4f9a-4cf5-b51a-643c908f9a90","UserId":"f5c0b263-1a7c-4b64-a3a6-7242c934bff0","UserName":"XXXXXXXXXXXXXXXXXXXXXXXXX","Email":"XXXXXXXXXXXXXXXXXXXXXXXXX","FirstName":"Jay","LastName":"M","CultureCode":"en","Address":{"AddressLine1":"","AddressLine2":"","City":"","State":"","PostalCode":"XXXXXXXXXXXXXXXXXXXXXXXXX","Country":{"Code":"USA","IsEEACountry":false,"href":"http://api.myqdevice.com/api/v5/Countries/USA"}},"TimeZone":{"Id":"America/Chicago","Name":"America/Chicago"},"MailingListOptIn":false,"RequestAccountLinkInfo":false,"Phone":"","DiagnosticDataOptIn":false}
2019-11-06 07:37:39.862 [TRACE] [hab.binding.myq.internal.AccountData] - myq accountId: f5c0b263-1a7c-4b64-a3a6-7242c934bff0
2019-11-06 07:37:39.870 [TRACE] [openhab.binding.myq.internal.MyqData] - Requesting URL https://api.myqdevice.com/api/v5/Accounts/f5c0b263-1a7c-4b64-a3a6-7242c934bff0/Devices
2019-11-06 07:37:40.088 [WARN ] [he.commons.httpclient.HttpMethodBase] - Cookie rejected: "$Version=0; TS01dfdd0d=01474093dc58e851a2b59a056679b678cbb477bef38263d6f25b6244c8f312a0e7d1c7be5d31f09687b238bc370b3bce1fa42fb8d9; $Path=/; $Domain=.api.myqdevice.com". Illegal domain attribute ".api.myqdevice.com". Domain of origin: "api.myqdevice.com"
2019-11-06 07:37:40.093 [TRACE] [openhab.binding.myq.internal.MyqData] - Received MyQ JSON: {"code":"404.401","message":"Not Found","description":"Account not found."}
2019-11-06 07:37:40.096 [TRACE] [openhab.binding.myq.internal.MyqData] - myq ReturnCode: 404.401
2019-11-06 07:37:40.111 [TRACE] [openhab.binding.myq.internal.MyqData] - myq ReturnCode: 404.401
2019-11-06 07:37:40.143 [ERROR] [nhab.binding.myq.internal.MyqBinding] - Could not connect to MyQ service
java.io.IOException: Request Failed: Unknown resonse
	at org.openhab.binding.myq.internal.MyqData.request(MyqData.java:289) ~[178:org.openhab.binding.myq:1.14.0.201911060339]
	at org.openhab.binding.myq.internal.MyqData.getMyqData(MyqData.java:123) ~[178:org.openhab.binding.myq:1.14.0.201911060339]
	at org.openhab.binding.myq.internal.MyqBinding.poll(MyqBinding.java:205) [178:org.openhab.binding.myq:1.14.0.201911060339]
	at org.openhab.binding.myq.internal.MyqBinding.access$0(MyqBinding.java:197) [178:org.openhab.binding.myq:1.14.0.201911060339]
	at org.openhab.binding.myq.internal.MyqBinding$1.run(MyqBinding.java:388) [178:org.openhab.binding.myq:1.14.0.201911060339]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

I assumed AccountId and UserId were the same, I guess that is not true.

I created a binding JAR that gets the AccountId instead, let me know if it works.

1 Like

last version works opens/closes door… just doing a bit more testing :slight_smile:

Okay, everything seems to work… but online status item doesnt update anymore.

Blockquote
String GarageDoorOnline “Garage Door Online [%s]” {myq=“GarageDoorOpener#online”}

The ‘#’ attributes support doesn’t work anymore with the new API.

Working here with the Switches, Lamp Plugs and my Garage Door opener.
Not seeing any errors.

Thanks Scott.

Thank you @scooter_seh