Chamberlain MyQ Binding

There are somehow illegal characters in your openhab.cfg file. Open it with a text filed editor and remove the garbage characters, save, and restart openHAB.

I have 9 MyQ Items
1 Universal MyQ Gateway + GDO
4 Lamp modules
5 Switches

Iā€™m using the 1.9.0 Snapshot Binding from the 1.9.0 Binding Package.

2016-12-29 20:45:12.803 [ERROR] [inding.myq.internal.MyqBinding] - Could not connect to MyQ service java.io.IOException: Null response from MyQ server at org.openhab.binding.myq.internal.MyqData.request(MyqData.java:208) ~[bundlefile:na] at org.openhab.binding.myq.internal.MyqData.getMyqData(MyqData.java:120) ~[bundlefile:na] at org.openhab.binding.myq.internal.MyqBinding.poll(MyqBinding.java:204) [bundlefile:na] at org.openhab.binding.myq.internal.MyqBinding.access$0(MyqBinding.java:196) [bundlefile:na] at org.openhab.binding.myq.internal.MyqBinding$1.run(MyqBinding.java:401) [bundlefile:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_65] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_65] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_65] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_65] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_65] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_65] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65]

I get this error pretty often. I find that if I disable most of the attributes it happens less. Is this something that can be fixed by adjusting the timeout or the refresh interval?

Any one have any clue why I periodically get Cannot connect to MyQ Service?
Am I hitting a limit on the API.
Is anyone else seeing this type of behaviour?

@scooter_seh

When I take a look at the code of the binding it looks like when the binding gets a command it enters in to a rapid poll rate. Which makes sense for a garage door openers (GDO) to get the open/close and intermediate states.

I think with multiple MyQ none-(GDO) items Iā€™m maybe overwhelming the API with the rapid refresh and this also introduces some oddities in to the Bus.
I notice that when Iā€™m using a switch for a scene or a rule that links many MyQ items that when for example Item myQ_light1 changes to ON sendcommand MyQ_light2 ON and another condition for an off condition. Light2 during the rapid refresh period will do on off on off cycle because the MyQ API reports the changing status of Light1 about 3 times a second. This also results in more commands being sent for light2 than desired and floods the bus. So far Iā€™ve been using thread::sleep (5000) to ensure that I donā€™t send too many updates/commands in to the bus.

Does anyone notice this? Would disabling rapid refresh for non-GDO be a good change for the lamp portion of the plugin and let the bus post the updates?
Or am I completely off base?

``} else if (device instanceof LampDevice) {

  •   			LampDevice lampModule = (LampDevice) device;
    
  •   			if (command.equals(OnOffType.ON)) {
    
  •   				myqOnlineData.executeMyQCommand(
    
  •   						lampModule.getDeviceId(), "desiredlightstate",
    
  •   						1);
    
  •   				**beginRapidPoll(true);**
    
  •   			} else if (command.equals(OnOffType.OFF)) {
    
  •   				myqOnlineData.executeMyQCommand(
    
  •   						lampModule.getDeviceId(), "desiredlightstate",
    
  •   						0);
    
  •   				**beginRapidPoll(true);**
    
  •   			} else {
    
  •   				logger.warn("Unknown command {}", command);``

After you first post I thought the start rapid polling code might be the problem. I will change it and get you a jar to try soon.

Thanks,
Scott

Try this JAR file and see if it works. I removed the quick polling for light devices.

@ scooter_seh

Youā€™re fast.
I had built my own Jar to test my theory.
I was going to report back after I had confirmed it.

I had set the code to false for lamp modules and fixed some typos in the
MyQResponseCode.java

``` UNKNOWN(-1, ā€œUnknow resonseā€);``

The jar with the disabled rapid poll for lamp modules fixes the first error I saw and reported.
The response of lamp modules especially in groups is slightly faster and more robust as now itā€™s only reporting status on change and @ 1 per minute as per the configured refresh interval.

From my short test I think having rapid poll false for lamp modules is the way to go.

I have 11 MyQ items in total and with the official 1.9.0 SNAPSHOT binding anytime I was sending commands to myq group triggered by a myq status change would result in some disneyā€™s haunted mansion craziness and slow response on my Rpi2 due to the bus getting flooded.

@tebore
I removed quick polling for the lamp modules but I didnā€™t want to wait a full minute for the status update. So I added a get status call 2 seconds after the set state request is sent. I am going to make it a configurable parameter but I wanted to get a fix for you to try. I hope to work on it some more tonight and add the source code to my github if you want to test it.

Thanks,
Scott

@ scooter_seh

Iā€™m curious if that 2 second poll after the set state is required.
Iā€™m just thinking out loud.
Commands sent via HAB update the states, unless for some reason the API is slow and the tail end 60 second refresh of the states overrides the sent command with the actual state of the item before the desired state is set at the switch (Iā€™ve had this happen once or twice but waiting a bit eventually everything syncs up).
I also remember that if the switch changes physically (physically flipping of the switch) it also updates the API and that will update the HAB.

I took a look at the code, thereā€™s no way to make MyQ response times better correct? The delay is in the cloud nature of the product? Thereā€™s a ~ 1 second delay on top of the Native MyQ App.

Its been a week and the new binding has been working like a charm

Just a suggestion: The Ecobee and Garadget bindings have a ā€œquick pollā€ configuration setting that tells the binding to poll state sooner after a command is sent to the remote system, so the user gets feedback sooner than a normal poll cycle. It might be one way to look at how to poll state for MyQ.

Hi everyone,

Iā€™m new to Openhab and setup, and Iā€™ve been trying to read and figure this out myself, but Iā€™m not having any success.

Iā€™ve configured MyQ with one garage door successfully and would like to add a second garage door, but Iā€™m not sure where to start. Iā€™ve made the following changes to my items and sitemap files but it still only recognizes one garage.

Group gMyOpenHAB

/MYQ Garage/
Group Garages
Switch GarageDoorSwitch ā€œGarage Door Openā€ (Garages, gMyOpenHAB) { myq=ā€œ1ā€ }
String GarageDoorString ā€œGarage Door [%s]ā€ (Garages, gMyOpenHAB) { myq=ā€œ1ā€ }
Contact GarageDoorContact ā€œGarage Door [%s]ā€ (Garages, gMyOpenHAB) { myq=ā€œ1ā€ }
Rollershutter GarageDoorShutter ā€œGarage Door Openā€ (Garages, gMyOpenHAB) { myq=ā€œ1ā€ }
String GarageDoorDesc ā€œGarage Door Desc [%s]ā€ (Garages) { myq=ā€œ1#descā€ }
String GarageDoorOnline ā€œGarage Door Online [%s]ā€ (Garages) { myq=ā€œ1#onlineā€ }
String GarageDoorDeviceId ā€œGarage Door Device Id [%s]ā€ (Garages) { myq=ā€œ1#MyQDeviceIdā€ }
String GarageDoorDeviceType ā€œGarage Door DeviceType [%s]ā€ (Garages) { myq=ā€œ1#MyQDeviceTypeNameā€ }
String GarageDoorSerialNumber ā€œGarage Door SerialNumber [%s]ā€ (Garages) { myq=ā€œ1#SerialNumberā€ }

Switch GarageDoorSwitch2 ā€œGarage Door Openā€ (Garages, gMyOpenHAB) { myq=ā€œ2ā€ }
String GarageDoorString2 ā€œGarage Door [%s]ā€ (Garages, gMyOpenHAB) { myq=ā€œ2ā€ }
Contact GarageDoorContact2 ā€œGarage Door [%s]ā€ (Garages, gMyOpenHAB) { myq=ā€œ2ā€ }
Rollershutter GarageDoorShutter2 ā€œGarage Door Openā€ (Garages, gMyOpenHAB) { myq=ā€œ2ā€ }
String GarageDoorDesc2 ā€œGarage Door Desc [%s]ā€ (Garages) { myq=ā€œ2#descā€ }
String GarageDoorOnline2 ā€œGarage Door Online [%s]ā€ (Garages) { myq=ā€œ2#onlineā€ }
String GarageDoorDeviceId2 ā€œGarage Door Device Id [%s]ā€ (Garages) { myq=ā€œ2#MyQDeviceIdā€ }
String GarageDoorDeviceType2 ā€œGarage Door DeviceType [%s]ā€ (Garages) { myq=ā€œ2#MyQDeviceTypeNameā€ }
String GarageDoorSerialNumber2 ā€œGarage Door SerialNumber [%s]ā€ (Garages) { myq=ā€œ2#SerialNumberā€ }

Thanks in advance.

Start numbering at 0 not 1

Myq= 0

@tebore

Sorry, I should have mentioned itā€™s a 3 car garage. I only want to control garages 1 & 2.

I assume youā€™ve already added the second Door to your myq account? Do you have any other MyQ items added to your account

This is a great binding! I was using it on 1.8 and now I have it working in 2.0 also.
Does anyone know if the api yet allows us to control the garage door light or get updates from the motion detector? Some discussion above seemed to be about an add on light device, I am only referring to the built in opener light and motion detector.

Thanks!

Thatā€™s not exposed in the Chamberlain API. Maybe in Garage 2.0 theyā€™ll open up the API some more.

Iā€™m a little new with 2.0. Can you help me or point me in the right direction to integrate this to my installation. Not sure if it will fix my problem, in the last few weeks it seems something has changed and I get errors trying to connect to chamberlain.

Anyone else having a problem connecting to the MyQ server? Mine just up and stopped working for some reason.

The trace shows that the request for a security token gets denied.
https://myqexternal.myqdevice.com/
Shows your request has been denied.

@scooter_seh looks like Chamberlain updated/deprecated their API.

A lot of people who rely on their unofficial API is going to be in for a surprise

http://forum.micasaverde.com/index.php/topic,24715.625/wap2.html
Found a discussion here.

Someone needs to hack the protocol on the other side of this, forget the cloudā€¦ maybe dns intercept? Iā€™ll have to look into this as soon as mine comes.