Something I’ve wanted to do for ages is setup some home automation. I grabbed myself a nice USB Z-Wave interface and a few devices and had a play with OpenHab2.  At the time of writing OpenHab2 has some great bits and some really clunky bits.  I decided to write this as a bit of a getting started guide and a reminder to myself for future configuration and gotchas, there are some huge holes in the documentation that require a lot of research to resolve.  As I do love the Raspberry Pi I decided that this was to be the device I would use to run the system.  It is a fresh install so in this instance I’m using a Raspberry Pi 3.

The basics are all covered pretty well on their website (except the Java 8 install):

  • Install Raspian and do the usual updates.
  • Install the key packaged dependencies
  • Install Java 8 from Oracle directly (found that out by Googling)
  • Update the valid sources to include theirs
  • Install OpenHab2 package via apt-get



Getting access to OpenHab was the first task.  It is pretty straight forward – point a browser at the IP address using port 8080.  So for example and then pick PaperUI.  This allowed me to then install all the components I thought I might find useful.  The main things I installed were:

  • Z-Wave binding
  • Hue Emulation
  • openHAB Cloud Connector
  • REST documentation

The rest of the stuff I’ll install and configure as I need them.  Most of the stuff hangs off the Z-Wave interface.



After installing the Z-Wave binding it couldn’t get the interface to come online.  No such thing as full plug and play here!  You have to specify the port presented by the Z-Wave interface.  This I identified simply by listing the /dev folder without it plugged in and then again with it plugged in.  It appears that most Z-Wave interfaces default to /dev/ttyACM0 (or a later number if you have other similar devices connected).  Once this was entered it kept reporting that it couldn’t find the port.  I managed to track this down to enabling the port within the Java options used to start OpenHab.  To do this I modified the file /etc/default/openhab2 and made sure it had the following line.  Note that by default it has a line that sets this to empty, make sure you edit that line otherwise it’ll override anything you put before it.


Of course the next thing is that it can’t actually open the port because it doesn’t have the correct permissions!  I thought the packaged installation would have configured dialout permissions, but it doesn’t look like that worked correctly.  So I simply changed permissions on the device to enable OpenHab to access it.  The following command did the trick:

sudo chmod 666 ttyACM0

When I had made both changes the Z-Wave interface reported as online!  I could then proceed to adding the devices.  A bit of playing with the UI and I had devices appearing and working.  I could turn them on and off within the Control tab of PaperUI.


OpenHAB Cloud

While making it all work inside the house is great, I really want access from outside so I can monitor things or set things going while away. is the ideal website to get this going.  While you can roll your own and configure it on your own web server, I figured that was something to do in the future.  For now I’m happy using their services.  Fortunately the instructions have improved since I first tried this.  There are two things you need the UUID and shared secret.  These are located in files on your OpenHab installation.  It was just a case of locating these items and editing the profile on the MyOpenHab website for the two to connect up and work.

You can locate them in /var/lib/openhab2/uuid and /var/lib/openhab2/openhabcloud/secret then just paste them in to your online profile.


Alexa Integration

I have the Amazon Echo and Echo Dots distributed around the house, so of course I want to integrate them all together.  There are two approaches, going via the MyOpenHab allows you to specify and OpenHab skill in Alexa.  This is great for the more complex tasks.  However i wanted to simply be able to control things quickly.  The round trip via Amazon, MyOpenHab and back to my device is not the fastest.  As a result I decided that the way I wanted to integrate them is to use the Hue Emulation component.  This makes OpenHab pretend to be a Philips Hue light fixture and allows devices to be discovered by the Echo.  Of course this isn’t at all simple to do because OpenHab has some quirky ways to handle this.  For the Echo to discover the device it has to be tagged with a device type recognised by the Echo.  In the case of a light fixture this is “lighting”.  Sadly PaperUI doesn’t have a feature to edit the tag, instead you have abandon the graphical UI and configure the devices completely via text configuration files!  This is totally horrific if you’ve just spent a while getting your devices setup.

I managed to discover a small bit of text that described using the REST API to modify the tag.  This turned out to be far easier than I had expected.  When you have installed the REST documentation you get an extra User interface option appear at the main OpenHab screen.  Click on REST API, then Items, the last item on the displayed list is PUT /items/{itemname}/tags/{tag}, click on this and when prompted enter the item name (as configured by you in PaperUI) and the tag you wish to assigned – in my case “Lighting” (note this is case sensitive).  Then click the Try it out! button and you should get a 200 response back reporting that it had completed.  The item is now correctly tagged and if you perform a device discovery on your Echo you’ll find it locating the item you just configured.  The best bit about using the Hue Emulation is how quickly it processes the commands and actions them compared to the lag you typically see on Skills.


End Result

It works really well.  I can ask for the study light to be turned on and off, or for the bedroom lights to be dimmed to a specific level.  It is fast and responsive via voice commands – no more getting out of bed on a cold winter night to turn the light off because I forgot in my rush to get in the warm bed!  It’ll take a while to get this fully rolled out across all the house, and I’ll want to look in to groups, macros, scheduling and sensors to really get full use out of this system.