LIQUIDATION SALE! FREE Shipping on orders over $49 USA $99 INTERNATIONAL USE CODE: "LIQUIDATION" for 50% OF

Garage Door (Chamberlain MyQ)

Garage Door (Chamberlain MyQ)

Product Links:
Chamberlain MYQ Devices: http://amzn.to/2t0d7Z3
Hey guys Matt here from MKSmartHouse.com and in this video I am going to show you how to connect a Chamberlain MYQ device to your OpenHAB 2 System.
I personally use the Chamberlain Garage Door Openers and use them to open and close my garage doors. If you want to control your garage doors I highly recommend the Chamberlain MYQ garage door openers. The only thing we are going to need for this video is the Chamberlain MYQ device, I will leave a link to the Chamberlain MYQ devices over on my website, the link is in the description. But, personally I have only used the Garage Door Openers. For this guide I am going to assume you already have the device installed and it is running perfectly using the setup instructions Chamberlain provides and you can control it from the Chamberlain MYQ app. I am also going to assume that you have a sitemap file, items file and a rules file. If you do not then go take a look at my video where I explain how to setup the configuration files in openHAB. I will not be making two seperate videos using Mac and PC because the process is really similar the only difference is that on mac you use Terminal to ssh and on PC you use putty.
 
1. The first thing we have to do is ssh into the OpenHAB Server.
 
I recommend having my website guide open when you do this so that way you can just copy and paste commands, link is in the description.
 
2. Now we are going go into the addons folder so we can download the binding to it, so type in cd /usr/share/openhab2/addons and press enter.
3. Then we are going to download the binding so type in wget https://openhab.ci.cloudbees.com/job/openHAB1-Addons/lastSuccessfulBuild/artifact/bundles/binding/org.openhab.binding.myq/target/org.openhab.binding.myq-1.13.0-SNAPSHOT.jar and press enter.
 
It should have downloaded the binding. The reason we are manually downloading it and not through the paper UI is because the binding in the paper ui is broken, I have tried it just does not work.
 
4. Any let's go back to the home directory so type in cd and press enter.
 
Now we need to restart openhab 2 so it can install the binding.
 
5. Type in sudo /etc/init.d/openhab2 restart and press enter.
6. Once it finished type in sudo nano /etc/openhab2/services/myq.cfg and press enter.
 
This is the myq configuration file.
7. This file may or may not be blank, if it is blank then paste the following in:
# Data refresh interval in ms (optional, defaults to 60000)
#refresh=60000
 
# Timeout for HTTP requests (optional, defaults to 5000)
#timeout=5000
 
# Chamberlain MyQ Username and Password
#username=
#password=
 
# Application ID for the MyQ API (optional, only recommended if existing ID ceases to work)
#appId=JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu
8. The first thing we are going to do is change the refresh interval so it updates faster, delete the # at the front of the line and change the refresh to 1000 
9. Next we are going to type in our myq credentials, so delete the # in front of username and type in your chamberlain myq username right next to the = sign.
10. Then delete the # in front of password and type in your chamberlain myq password right next to the = sign.
 
Please make sure that when you type in these values you do not put in a space after the equal sign.
 
11. Once those are typed in press control x then y and enter to save.
12. Next we are going to add the items so type in sudo nano /etc/openhab2/items/home.items and press enter.
13. Then type in the following:
 
Switch GarageDoorSwitch "Garage Door Open" <garagedoor> {myq="0"}
Contact GarageDoorContact "Garage Door [%s]" <garagedoor> {myq="0"}
String GarageDoorString "Garage Door [%s]" <garagedoor> {myq="0"}
Rollershutter GarageDoorShutter "Garage Door Open" <garagedoor> {myq="0"}
String GarageDoorCustomerName "Garage Door Name [%s]" <garagedoor> {myq="0#customerName"}
String GarageDoorDesc "Garage Door Desc [%s]" <garagedoor> {myq="0#desc"}
String GarageDoorOnline "Garage Door Online [%s]" <garagedoor> {myq="0#online"}
String GarageDoorDeviceId "Garage Door Device Id [%s]" <garagedoor> {myq="0#MyQDeviceId"}
String GarageDoorDeviceType "Garage Door DeviceType [%s]" <garagedoor> {myq="0#MyQDeviceTypeName"}
String GarageDoorSerialNumber "Garage Door SerialNumber [%s]" <garagedoor> {myq="0#SerialNumber"}
 
These are all the items that we have from the chamberlain myq api. I made two sets of these items in mine because I have two garage door openers. If you have more than 1 like me then you increment the myq number. It goes in order the way you added them into the app. So, it starts of at 0 and continues on. I have 0 and 1 but if you only have one device then you would just use 0. The funny thing is that I actually added garage door number 2 before number 1 so in my items file I have it backwards if you are looking at the MYQ number. Also, I changed the item names to reflect which garage door they are foor so I put a 1 at the end of the ones for garage door 1 and a 2 for garage door 2.
 
14. Once all those are set press control x then y and enter to save.
 
Now we are going to add all these items into the sitemap file so we can see them in the interfaces,
 
15. So type in sudo nano /etc/openhab2/sitemaps/home.sitemap and press enter.
 
If you are following along with my videos then you know we have a bunch of frames in our sitemap files. I am going to put these items into the garage frame.
 
16. So delete everything in the garage frame and paste in the following:
 
Switch item=GarageDoorSwitch
Text item=GarageDoorString
Text item=GarageDoorContact
Switch item=GarageDoorShutter
Text item=GarageDoorCustomerName
Text item=GarageDoorDesc
Text item=GarageDoorOnline
Text item=GarageDoorDeviceId
Text item=GarageDoorDeviceType
Text item=GarageDoorSerialNumber
 
Like I said before I have 2 garage door openers so I have two sets of these.
17. Once those are all set, press control x then y and enter to save.
 
Let’s test out what we have so far!
 
18. Go into your web user interface and then basic UI.
 
If you scroll down to Garage you should see all the stuff for the garage doors. This is great and all but there is still 1 more thing I want to do and that is get notifications regarding the garage doors.
 
19. So, go back to the ssh window and type in sudo nano /etc/openhab2/rules/home.rules and press enter.
 
20. Then type in the following code:
 
//Garage Door Notifications and 5 min warning
rule "Garage Door "
when
  Item GarageDoorSwitch changed
then
   if(GarageDoorSwitch.state == ON)
   {
       sendBroadcastNotification("GARAGE: DOOR OPEN")
       createTimer(now.plusMinutes(5)) [|
           if(GarageDoorSwitch.state != OFF)
           {
               sendBroadcastNotification("GARAGE: DOOR IS OPEN FOR OVER 5 MIN")
           }
       ]
 }
 else if(GarageDoorSwitch.state == OFF)
 {
     sendBroadcastNotification("GARAGE: DOOR CLOSED")
 }
end
 
Since I have 2 garage doors I am going to paste it in 2 times and modify accordingly. Let me explain what this rule does. It sends and notification when the door opened and closed as well as send a notification if the door has been open for more than 5 minutes. The reason I did the 5 thing is because sometimes when people drive out of the garage they forget to close it so this just provides a friendly reminder.
 
21. Once you are done press control x then y and enter to save.
 
That is it! The chamberlain myq garage doors have been set up, so let’s go test it. Alright as you can see I am in front of my garage and in my hand I have a mobile device that is connected to the openhab 2 server using the openhab mobile app. If you haven’t seen it make sure you check out that video, I show you exactly how to connect a mobile device to your openhab server. Anyway lets first test garage door 1 and as you can see if I press the up arrow the door opens. Now lets do the other door as you can see if I press the arrow it also opens. Next I am going to press the down arrow for garage door 1 and garage door 2 and as you can see after 15 seconds they are going to close. The reason you have to wait 15 seconds is because of safety, Chamberlain implemented this safety thing where it beeps and flashes for 15 seconds to let people know it is closing. It only does this when you do it from something other than the wireless remotes. Anyway as you can see it all clearly works and when we did all of this we were getting notifications at the bottom of the screen. Great! The device is connected and working! Now we can control this chamberlain myq device from our openhab system using either a mobile device or any of the web user interfaces! In the next video we will be connecting the amazon echo to openhab! Alright thank you for watching and If you have any questions leave them in the comments section below or head over to mksmarthouse.com/forum where you have a better chance of it getting answered. Good Bye!