FREE Shipping on orders over $49 USA $99 INTERNATIONAL

Google Home and OpenHAB 2

Google Home and OpenHAB 2 

Demo: 

Hey guys Matt here from MKSmartHouse.com and in this video I am going to show you how to connect the Google Home to your OpenHAB 2 System.
I love the Google Home and think it is an awesome device that makes controlling smart devices really easy with voice control. You can be in another room and yell to google and tell it to turn on a device for you. In this video we will be connecting google home to our openhab 2 system so it can control our openhab items. For this video we are going to need a device running IOS or android, a computer running Windows or MacOS, an openHAB server and the star of the show a google home device. The links to all the devices, parts and guides mentioned are in the video description.
Speaking of links in the description, follow @mksmarthouse on twitter, instagram and snapchat because those are the place where I give sneak peaks on when videos are releasing and also where I ask for your input on topics and future videos. Lately I have also been posting things that only a true smart home enthusiast would appreciate.
For this guide I am going to assume you already have the google home installed and it is running perfectly using the setup instructions google provides and you can control it and can access it from the Google Home app. I am also going to assume that you have a 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 separate 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.
If you are a smart home enthusiast like me and want to show that you are an Elite Member of the smart home community then check out smarthousesociety.com for premium quality hoodies, shirts and hats. Supplies are limited so check out the link in the description now!
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. 
2. Now type in sudo nano /etc/openhab2/items/home.items and press enter. 
3. Now we are going to add the tags that the Google Home supports to the items. The tags go right before the bindingconfig. The Google Home supports the following tags. [ “Switchable” ] This tag is used with the Switch item type, Dimmer item type, Color item type, as well as the Rollershutter item type, but you would not use this for a light that is what the next one is for. [ “Lighting” ] This tag is used for lights with the Switch item type, Dimmer item type, and the Color item type. [ “CurrentTemperature” ] This tag would be used with a device that reports temperature and has the Number item type. [ “Thermostat” ] This tag is used with an item that has a Group item type and has the following devices in the Group [ “CurrentTemperature” ] [ “TargetTemperature” ] [ “homekit:HeatingCooling” ] I personally do not use the tags associated with the Thermostat and have never used them but if you want more information on them then check it out the github, link is on my website, which is in the description. I just use the Lighting and the Switchable one, in the future we may be using the Current Temperature one. Alright let's take a look at my items file because I have already put in the tags. As you can see I put the Switchable tag next to the items that are the Switch item type but are not lights. I also put the switchable tag into the GarageDoorShutterDummy items because they are of the Rollershutter item type. Here is the complete item:
Rollershutter GarageDoorShutter1Dummy "Garage Door 1" <garagedoor> [ "Switchable" ]
I created a dummy switch for the garage doors because chamberlain myq does not like the command it receives when the google home talks to it so I created the dummy Rollershutters as a sort of Middleman to handle the requests. I will talk more about this later. You can also see I used the Lighting tag for the two light switches. I also used the lighting tag for my color led strips. If you guys have any questions on these tags leave them in the comments because chances are someone else probably has it too. 
4. Anyway once all your tags are in place, press control x then y and enter to save. 
Now we have to address the Rollershutter items because when the google home sends a command it uses percents so let’s fix it. This step is optional and only if you have a Rollershutter item that needs on and off or up and down instead of percents. 
5. Type in sudo nano /etc/openhab2/rules/home.rules and press enter. 
6. Then type in the following:
rule "Garage Door 1 Voice Control"
when
    Item GarageDoorShutter1Dummy received command
then
    if (receivedCommand < 50)
    {
      sendCommand(GarageDoorSwitch1, ON)
    }
    else
    {
      sendCommand(GarageDoorSwitch1, OFF)
    }
end
I pasted it in twice and modified it because I have two garage doors. All this rule is doing is taking the percent from the dummy items and then either sending the on or off command to the device. If your device requires up or down then change the ON to UP and OFF to DOWN. 
7. Now press control x then y and enter to save. 
Great! The items are now ready, so the next thing we are going to do is connect the Google Home. 
8. So grab your mobile device that already has the Home app installed and open the app. 
9. First press the three lines at the top left to bring up the menu. 
10. Then press on home control. 
11. In the bottom right click on the plus sign. 
12. It will bring up a list smart devices you can add to the google home, scroll down and press on openhab. 
13. It will open up a web browser page, so type in your myopenhab.org username and password and press sign in. 
14. It will load a new page, press allow. Once that is finished it will say something like authorized or connected. After it will show you all of the items it found, if you want you can go through and organize the devices by room. 
15. Then hit done. 
That is it! The google home now has access to all your devices and you can control them with voice commands! Let’s test it. “Ok google, turn on MK Light” “Ok Google, set Garage Door 1 to 0%” “Ok Google, turn on Sprinklers Zone 1” “Ok google set Desk LED Strip to Blue” “Ok google set MK Blinds to 100” Great! The device is connected and working! Now we can control our openHAB items with voice commands! That concludes this complete guide to connecting the google home to openhab 2. In the description you will find links to all the parts and devices used in the video as well as a link to mksmarthouse.com/shop where I have a wide range of smart home kits that you can put together such as blinds, led strips, sprinkler system and door sensors. 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. Good Bye!

Google Home and OpenHab 2

Links:

Google Home Mini: https://goo.gl/wW58Se
All Google Home Devices: https://goo.gl/ZLZxT1
Computer: https://amzn.to/2HzbsOA
Phone 1: https://amzn.to/2JFilOR
Phone 2: https://amzn.to/2qufv7o
SD Card Reader: http://amzn.to/2lqsvL1
Raspberry Pi 3: http://amzn.to/2m62Kg6 - doesnt work
Power Adapter: http://amzn.to/2lIyh5E