As many of you will know I use Raspberry Pi’s for a lot of things around my smart house, except for use one to actually run my smart home. I have tried Home Assistant on a Raspberry Pi in the past and even tried it again recently running in a Docker Container but I have always ended up abandoning the project. Well, today I am trying a new project this time with openHAB running in a Docker Container on my Raspberry Pi that runs Pi-hole. As I have written many times in the past I am a fan of Docker and its ability to let a user run countless numbers of services on one machine. This can be especially helpful on a Raspberry Pi because let’s be honest there is no shortage of fun and cool projects you can do with a Raspberry Pi. Let’s take a walk through what openHAB is and how to get it set up on your Raspberry Pi.
While researching Raspberry Pi based home automation ecosystems looking for something that I might stick out longer than Home Assistant I came across openHAB. Now I had heard of openHAB before but never really looked into it too much for one reason or another but this time something was different and I decided to look into it. So what is openHAB? Well according to there website “openHAB is a vendor and technology agnostic open source automation software for your home.” That’s great but what does it mean? It means that openHAB (like Home Assistant) is the software backbone of your home automation system running on a device such as a Raspberry Pi. Being vendor and technology agnostic means that openHAB is not back by nor are they backing any device, service or technology but yet open to any that can be developed for in openHAB. With openHAB up and running on your Raspberry Pi, you have a complete user customizable experience in front to you that can run locally (unless you are connected cloud-based devices) and give you the type of flexibility and tweakability that most of us home automation geeks require.
- From the Raspbian Desktop launch Terminal
- From Terminal run to create the openHAB user group and assign your user to it:
- sudo useradd -r -s /sbin/nologin openhab
- sudo usermod -a -G openhab <username>
- Next, run the following commands from the terminal to create the required directories:
- sudo mkdir /opt/openhab
- sudo mkdir /opt/openhab/conf
- sudo mkdir /opt/openhab/userdata
- sudo mkdir /opt/openhab/addons
- sudo chown -R openhab:openhab /opt/openhab
- Now before we run the Docker Container we need to get our User_ID and Group_ID by running the following command in Terminal and writing down these two numbers:
- id openhab
- From a web browser go to https://hub.docker.com/r/openhab/openhab/ and make note of the version number of the latest stable build of openHAB.
- Now its time to run the Docker Container, use the below command in Terminal inserting the the User_ID, Group_ID and openHAB Version we previously gathered.
- docker run \
–name openhab \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-v /opt/openhab/conf:/openhab/conf \
-v /opt/openhab/userdata:/openhab/userdata \
-e USER_ID=<User_ID> \
-e GROUP_ID=<Group_ID> \
That’s it openHAB is now running in a Docker Container on your Raspberry Pi. all you have to do now is from a web browser navigate to http://<ip_address_of_pi>:8080 and you will be greeted with the openHAB setup UI. In my opinion, this is where openHAB is superior to Home Assistant because you are given a simple to use graphical interface by which to set up your system. You will first be prompted to pick a package from Simple, Standard, Expert and Demo with Standard being the recommended so we will pick that. After that, you will pick a UI with Paper UI being the one you should start with as it is the easiest to get your devices into.
Once you are through the basic set up and in the Paper UI you are ready to start adding things. The majority of this will be done through “Bindings” which are the different API packages for various devices much like “Components” in Home Assistant. Now this is where openHAB falls behind Home Assistant as openHAB does not have nearly the same size library of “Bindings” as Home Assistant does “Components” but for my application, everything I have is supported so its a non-issue. To start adding things you basically select the appropriate “Binding” from the Add-ons section and then from the “Inbox” scan for devices, it really could not be simpler. In most cases, no coding (like yaml) is needed to add devices and you can quickly have your devices added.
Now there is one more aspect that I feel makes openHAB vastly superior to Home Assistant and that is in its documentation. Everything you could need can be found at https://www.openhab.org/docs/tutorial/. I know what you are going to say Home Assistant has this as well but I find that most of the time the documentation for Home Assistant makes assumptions that people are as technically savvy as the writers and that is not always the case. I usually find myself searching all over the place piecing bits of information together to get things set up in Home Assistant. With the documentation available for openHAB, however, this is not the case, everything I needed was right there and coupled with the GUI things were straight-forward and easy to set up and this alone could be what gets me to continue using openHAB.
Now, am I going to abandon SmartThings for openHAB probably not but I will be using openHAB to supplement my SmartThings system and hopefully accomplish some pretty cool things. Between openHAB, its clean UI and available integrations, SmartThings, IFTTT and MQTT the automation opportunities ahead of me are endless and exciting and I can not wait to do more.
Are any of you running openHAB? Let me know your experiences in the comments below.
I am passionate about the IoT and connected devices. Using connectivity to automate our lives will empower civilization to achieve greatness.