Starting off with OpenHAB

To start off, I would like to get OpenHAB running on my Linux based laptop. The assumption is that Java will be available on the end system that will eventually host the OpenHAB server.

Cloning OpenHAB

Clone the latest version of OpenHAB source from GitHub. This is fairly simple.

git clone

Installing Build System

OpenHAB is built and managed using Maven build system. It performs automatic resolution of all the dependencies present in your workspace. If you don’t have Maven yet, get it first.

sudo apt-get update

sudo apt-get install maven

mvn -V
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “3.2.0-67-generic”, arch: “amd64”, family: “unix”

Building OpenHAB

Please note that Maven requires that Java home to be setup properly. I use OpenJDK 7 on a 64 bit, and hence my JAVA_HOME is setup as,

JAVA_HOME = /usr/lib/jvm/java-7-openjdk-amd64/

If JAVA_HOME is incorrectly set, Maven will not be able to build anything.

Go to the newly cloned OpenHAB repository and perform a clean build,

cd openhab

mvn clean install

Please remember that Maven will take a lot of time for the first build since it downloads all the libraries. This will happen if you perform a clean everytime. To avoid this and to enforce Maven to use the locally cached libraries and dependencies, use the -o option

mvn install -o

If the build is successful, you will have the OpenHAB distribution zipped under ./distribution/target/. You should be expecting to see these packages,

cd distribution/target/

ls -l

Of interest are the following distributions, : Contains the core OpenHAB modules Contains support for bundles that provide support for various types of devices. Provides demo configurations and sitemaps.

Starting OpenHAB

For a quick check, copy the above 3 distributions into a separate location and follow the below 4 steps,

1. Unzip the runtime distribution first.


2. Unzip the demo distribution and say yes to any overwrite prompt.


3. Move the addons distribution into the addons directory and unzip it there. Say yes to any overwrite prompt.

mv addons/

cd addons/


4. Go back to the parent directory and then to configuration directory. Make a copy of OpenHAB default configuration as a running configuration. This is good enough to run in the demo mode.

cd ../

cd configurations/

cp openhab_default.cfg openhab.cfg

Now OpenHAB is ready to run in demo mode. Go back to the parent folder and you will find couple of start shell scripts. Run the and wait for a few seconds. Now go to the demo URL [ http://localhost:8080/ ] offered by OpenHAB server on your localhost, and have the first look at the GUI in the demo mode. You will be able to play around and change the state of some devices.

OpenHAB Demo Home
OpenHAB Demo Home
OpenHAB Demo - First Floor View
OpenHAB Demo – First Floor View
OpenHAB Demo - Bath View
OpenHAB Demo – Bath View

Now I cannot wait to toggle an LED with this web interface on my RaspberryPI.


2 thoughts on “Starting off with OpenHAB

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s