Chamberlain MyQ Binding

@leerich I found an error in the binding’s regex. I fixed it and made a JAR that I hope will work for you. Please give it a try and let me know. Thanks.

https://drive.google.com/file/d/0Bx6EpCMtJQHVZ21ZRXdfTDY3Z28/view

@scooter_seh

Hey Scott and others. I’ll try and update my binding tonight if I can and test it out. But was curious if anyone has tried the binding on OH2 yet? Anyone know if it will work?

It works with OH2.

Thanks Scott.

I’m assuming we need to manually create **.cfg file for it? Would that be named MyQ.cfg or Chamberlain.cfg, etc?

myq.cfg should work. Make sure to leave out the myq: prefixes in the file.

I actually should have installed the binding first :slight_smile: It created it after I installed it. I didn’t know it did that for 1.9 bindings.

1 Like

[SOLVED] - Make sure you remove the spaces before the user and pass in the.cfg file!
@scooter_seh
I used to run OH 1.7.1 on my windows PC, but I bought a pi and installed 1.8.1 on there. The hardware i’m using is this: https://www.liftmaster.com/for-homes/Accessories/MyQ-Accessories/model-821LM

I’m bummed since I used to have this working, but now it’s not.

.items:
//Garage
Switch GarageDoorSwitch “Garage [%s]” {myq=“0”}
Contact GarageDoorContact “Garage [%s]” {myq=“0”}
String GarageDoorString “Garage [%s]” {myq=“0”}
Rollershutter GarageDoorShutter “Garage [%s]” {myq=“0”}

.sitemaps
Switch item=GarageDoorSwitch
Text item=GarageDoorString
Text item=GarageDoorContact
Switch item=GarageDoorShutter

openhab.cfg
############################## Chamberlain MyQ Binding ##############################
#
# Data refresh interval in ms (optional, defaults to 60000)
# myq:refresh=60000

# Timeout for HTTP requests (optional, defaults to 5000)
# myq:timeout=5000

# Chamberlain MyQ Username and Password
 myq:username=*****@gmail.com
 myq:password=******

# Application ID for the MyQ API (optional, only recommended if existing id ceases to work)
# myq:appId=JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu

Binding: org.openhab.binding.myq-1.8.2-SNAPSHOT.jar

Any ideas?

I’m concerned about the spaces at the beginning of the lines above. Could you remove those leading spaces?

They have been removed. No change unfortunately.

Did you stop and restart openHAB, just for good measure? Does anything about the binding appear in the log? Is the binding JAR in the addons folder?

THANK YOU! apparently restarting did the trick along with removing the spaces. I’ll update my earlier post.

1 Like

I have added light switch support and the ability to get other attributes to the Chamberlain MyQ Binding. I do not have a lamp module to try light support so any feedback would be helpful. If you have a lamp modules the new binding could change you item configurations. Your Garage Door may be { myq=“1” } now and your lamp module { myq=“0” } instead. If you enable trace logging you can see what attributes are supported with your MyQ Devices. Attributes are only support with string items at this time. If no attribute is specified the binding will use the door state or light state as before. Here are some example item configurations with and without attribute support…

Switch GarageDoorSwitch         "Garage Door Open"                      { myq="0" }
Contact GarageDoorContact       "Garage Door [%s]" <contact>            { myq="0" }
String GarageDoorString         "Garage Door [%s]"                      { myq="0" }
Rollershutter GarageDoorShutter "Garage Door Open"                      { myq="0" }    
String  GarageDoorCustomerName  "Garage Door Name [%s]"                 { myq="0#customerName" }
String  GarageDoorDesc          "Garage Door Desc [%s]"                 { myq="0#desc" }
String  GarageDoorOnline        "Garage Door Online [%s]"               { myq="0#online" }
String  GarageDoorDeviceId      "Garage Door Device Id [%s]"            { myq="0#MyQDeviceId" }
String  GarageDoorDeviceType    "Garage Door DeviceType [%s]"           { myq="0#MyQDeviceTypeName" }
String  GarageDoorSerialNumber  "Garage Door SerialNumber [%s]"         { myq="0#SerialNumber" }

If you have any issues please let me know. Links to my github branch and google drive with the new JAR file are below. Thanks for the help.

https://github.com/computergeek1507/openhab/tree/myq_lamp

https://drive.google.com/open?id=0Bx6EpCMtJQHVRWZKSmV0NUtZU0E

1 Like

@BrianHanifin @digitaldan I purchased a 825LM Light Switch and it worked with the newest version of the binding I wrote. Looking at the instructions, you can only pair the 825LM with your MyQ Internet Gateway OR your wireless Remote OR the garage door opener. I paired mine with my MyQ Gateway and it worked as expected. I attached my configurations and a link to my google drive with the newest binding below. If you have any problems please let me know. Thanks

Switch  LampModule              "Lamp Module On"                        { myq="0" autoupdate="false"}
String  LampModuleCustomerName  "Lamp Module Name [%s]"                 { myq="0#customerName" }
String  LampModuleDesc          "Lamp Module Desc [%s]"                 { myq="0#desc" }
String  LampModuleOnline        "Lamp Module Online [%s]"               { myq="0#online" }
String  LampModuleDeviceId      "Lamp Module Device Id [%s]"            { myq="0#MyQDeviceId" }
String  LampModuleDeviceType    "Lamp Module DeviceType [%s]"           { myq="0#MyQDeviceTypeName" }
String  LampModuleSerialNumber  "Lamp Module SerialNumber [%s]"         { myq="0#SerialNumber" }

Contact GarageDoor              "Garage Door [MAP(en.map):%s]" <contact>{ myq="1" } 
String  GarageDoorStatus        "Garage Door Status [%s]"               { myq="1" } 
Switch  GarageDoorOpener        "Garage Door Open"                      { myq="1" autoupdate="false"}
Rollershutter GarageDoorShutter "Garage [%s]"                           { myq="1" }
String  GarageDoorCustomerName  "Garage Door Name [%s]"                 { myq="1#customerName" }
String  GarageDoorDesc          "Garage Door Desc [%s]"                 { myq="1#desc" }
String  GarageDoorOnline        "Garage Door Online [%s]"               { myq="1#online" }
String  GarageDoorDeviceId      "Garage Door Device Id [%s]"            { myq="1#MyQDeviceId" }
String  GarageDoorDeviceType    "Garage Door DeviceType [%s]"           { myq="1#MyQDeviceTypeName" }
String  GarageDoorSerialNumber  "Garage Door SerialNumber [%s]"         { myq="1#SerialNumber" }

1 Like

Very cool, do you need help testing?

I was hoping you could look at my code and see if I can improve anything before I submit a pull request. Thanks!

https://github.com/computergeek1507/openhab/tree/myq_lamp

@scooter_seh: your new attributes could support any possible item type using the TypeParser, instead of only String items, by changing code around here like:

if (!deviceConfig.attribute.isEmpty() && garageopener.hasAttribute(deviceConfig.attribute)) {
  newState = TypeParser.parseState(deviceConfig.acceptedDataTypes, garageopener.getAttribute(deviceConfig.attribute));
  if (newState == null) {
    newState = UnDefType.UNDEF;
  }
} else {
  for (Class<? extends State> type : deviceConfig.acceptedDataTypes) { 
    // same loop as before, minus the deviceConfig.attribute handling
  }
}
// post the new state as before...
1 Like

This is working great! What great timing. I have a new Raspberry Pi 3 set to arrive tomorrow. I can’t wait to transfer my setup off of my laptop and start using this for real! :slight_smile:

MyQ login error. I’m pretty new to Openhab. I’ve installed 1.8 and org.openhab.binding.myq-1.8.1.jar in the addons folder.

My openhab.cfg is modified with credentials which work.
############################## Chamberlain MyQ Binding ##############################
#
# Data refresh interval in ms (optional, defaults to 60000)
myq:refresh=10000

# Timeout for HTTP requests (optional, defaults to 5000)
# myq:timeout=5000

# Chamberlain MyQ Username and Password
myq:username=*****@hotmail.com
myq:password=******

# Application ID for the MyQ API (optional, only recommended if existing id ceases to work)
# myq:appId=JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu

This log shows the login error. It mentions 1.7 which could be a clue:

java.io.IOException: Request Failed: Login error. Please login again.
	at org.openhab.binding.myq.internal.MyqData.request(MyqData.java:225) ~[bundlefile:na]
	at org.openhab.binding.myq.internal.MyqData.request(MyqData.java:221) ~[bundlefile:na]
	at org.openhab.binding.myq.internal.MyqData.getGarageData(MyqData.java:106) ~[bundlefile:na]
	at org.openhab.binding.myq.internal.MyqBinding.poll(MyqBinding.java:198) [bundlefile:na]
	at org.openhab.binding.myq.internal.MyqBinding.access$1(MyqBinding.java:190) [bundlefile:na]
	at org.openhab.binding.myq.internal.MyqBinding$1.run(MyqBinding.java:365) [bundlefile:na]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_45]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_45]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_45]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
	at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]

I’ve restarted the server once. I’m not sure if I need to restart the server for openhab.cfg changes to be noticed or not.

I have OpenHab 1.8 on a Mac and am getting the error: “Could not connect to MyQ service”. The rest of the error is:
java.io.IOException: Request Failed: Login error. Please login again.
at org.openhab.binding.myq.internal.MyqData.request(MyqData.java:225) ~[bundlefile:na]
at org.openhab.binding.myq.internal.MyqData.request(MyqData.java:221) ~[bundlefile:na]
at org.openhab.binding.myq.internal.MyqData.getGarageData(MyqData.java:106) ~[bundlefile:na]
at org.openhab.binding.myq.internal.MyqBinding.poll(MyqBinding.java:198) [bundlefile:na]
at org.openhab.binding.myq.internal.MyqBinding.access$1(MyqBinding.java:190) [bundlefile:na]
at org.openhab.binding.myq.internal.MyqBinding$1.run(MyqBinding.java:365) [bundlefile:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]

It isn’t complaining of a credential error and I’ve double checked the credentials. In the errors I see some mentions of 1.7 and I’ve got the 1.8 jar file in addons, maybe a problem? Or a firewall issue?

I got this working with my two Chamberlain 888LM wall controllers. The binding brings in the open/close status and is able to control the door, but it’s not bringing in any of the information from the MyQ API such as the Door Name, Serial Number, etc. Those items shows up as “-”. I created duplicate items with the first being 0 and the second being 1 and they correspond to the order they were added to the MyQ account - am I missing something else?