Dave Bywaters
homeautobanner.jpg

Home Automation

Utilising open source automation software with off the shelf devices, and in the future DIY micro controller sensors, see how I bring some Siri magic to controlling my home.

"Hey Siri turn the kitchen lights on.... "

I have liked the idea of home automation for some time having started with the Phillips Hue lighting systems and also played around with Arduino and Raspberry Pi sensor projects. The Hue lights are great and I run them in three lamps, the first generation starter kit there were not Apple HomeKit compatible and so don't work with Siri out of the box.  
Update: I have a new HomeKit compatible Hue bridge that was ordered from the US, as I couldn't find anyone with a nextgen model in Australia at the time.  They are now available.

There are lots of non HomeKit enabled devices and so our solution is to get them working with Siri using openHAB.  To quote their website:

 [openHAB is] a vendor and technology agnostic open source automation software for your home.  Build your smart home in no time!

So I setup a quick prototype on my MacBook Pro running the openHAB 2 Beta Snapshot, I did try the 1.8.2 version but didn't have much luck with some WeMo devices.. more about that later.
With my OpenHAB2 prototype I have successfully connected my Hue Bridge (Gen 1) in addition to some Belkin WeMo devices, then using the HomeKit Integration and a compatible IOS app, I can control them all with Siri!

Want to see how this is done?

The Plan

  1. Select a Home Automation server
    I have Apple iMAC that I will dedicate as a openHAB server, I could have used a Raspberry Pi though to be honest I have never actually left one running for any length of time so still to be convinced if they are ready for prime time or not.  The iMac will also run any Home Theatre needs in my new house.
  2. Setup devices on your wireless network.
    I already have the Hue Bridge running in my network with 3 bulbs and recently a new LED light strip.  I also have a Belkin WeMo Insight Switch and a Light Switch, with some more WeMo devices not yet setup.
  3. Install openHAB 2 and perform the configurations
    We will run through configuring the bindings, searching for "things" and then create the "items" used in the User interface.  This will make sense as we go through it.
  4. Setup the openHAB HomeKit Integration.
  5. Use a HomeKit supported app on an IOS device
    I will use "Insteon+" to setup Zones, Rooms and Scenes to enable the various Siri commands.  
    You can tell Siri "Good Night" and she (he, it?) will turn all the lights off, including my Coffee machine should I have accidentally left it on.

Home Automation Server

As mentioned I have a iMac (24-inch, Early 2009) available, it runs a 2.66 GHz Intel  Core 2 Duo with 4GB of DDR3 Memory.  When I firsts stated this project I just completed a fresh install of OS X El Capitan, Version 10.11.4.  

This way I can show you all the software and configuration required to get openHAB working, I can already tell you that you will need the Java 1.8 JDK.

Device Setup

You will need to do this before you go near openHAB.  

Philips Hue

As I already have the Hue Systems setup, the bridge on my network and the the globes installed, I won't so won't go into that detail.  The bridge is required as these devices communicate using the ZigBee Light Link open standards protocol and not normal Wi-Fi.
You should find the initial install is pretty straight forward as is adding new lights.  I have recently bought a set of the LED Strip lights, which was expensive however not that much than if you are going to dedicated a micro controller and try and control a cheaper set of coloured led strip lights yourself.

Check out this video {to be inserted later} where I add the Strip lights, simple as the bridge detects the new device and then using the app you simply rename them as required.  I set mine to "Kitchen Strip" and then added them to a Scene to test the colour range. 

Belkin Wemo

I have an Insight Switch and a Light Switch already on the network, no bridge is required as these WeMo devices use your local Wi-Fi.  

To setup these devices you plug them in and then they start emitting their own Wi-Fi network.  

You then connect your smart phone, iPhone in my case, to that network then launch the WeMo app.  You then rename the device and select which W-Fi network to connect to.  In this video {to be inserted later} you will see that as I have already setup previous devices the Wi-Fi setting are remembered and automatically applied to new devices.

Samsung TV

I was happy to see Samsung TV bindings in open HAB, more on that later.  To prepare the TV you simple ensure it's on your Wi-Fi network and note the IP address, in my case 192.168.0.144.  To ensure your devices get same IP addresses I would recommend you assign a permanent DHCP lease on on your router or use static IP addressing.

openHAB2 installation

Download

I am using the openHAB 2 Beta Snapshot "Offline Distro" available from http://www.openhab.org/getting-started/downloads.html
This is the only thing you will need from this site, the Designer doesn't yet support version 2, as detailed here you can instead use the

Unpack

Most people suggest you unpack the files into /opt/openhab.  This can be done via the command line using sudo or via Finder.  Either-way you will be prompted for credentials to create the directories under you root folder (aka Macintosh HD).

Start openHab

From a terminal window run /opt/openhab/start.sh.  
Then from the openhab> prompt I suggest you run log:tail to see the running log.

* Note that if you'd don't have the Jave JDK installed then openHAB will fail with a JVM warning, I'll capture this and update the page once I proceed with a fresh install.

 

Open Web Interface

Launch http://localhost:8080 and choose the PAPER UI which is the configuration interface.
 

 

Add Bindings

Choose Extensions in the left hand menu and then ensure you are on the BINDINGS tab.

From hear search for "hue" and click install next to the correct option.

 

Add Things

From the Inbox choose the Hue Bridge and then "ADD AS THING"

 

The Hue Bridge will be added, however you will need to physcially press paring button on your bridge.

Look out for the warning in the log which you should be "tailing" in the terminal window.

 

You will see all the lights are discovered and also will show up in the Inbox.  From now on whenever you add new lights these should be detected and will show up on the Inbox for you to add.

Now click on the tick icon next to each light and  select each one and "ADD AS THING".

You can choose to rename then, however I would suggest you try to get the naming conventions correct when you first setup your devices.

You will then see then available in Configuration -> Things.  However you won't have any items yet to link to the appropriate Service Channel... this make sense in the next part.

hueinboxlights.png

Create Items

Now for the text part... unfortunately not everything can be done via a GUI at the moment. We will need to create a sitemap and items file.

{more to follow... }