Installing OpenHAB on Pi

Post date: Apr 30, 2015 2:42:39 PM

Installing OpenHAB on Pi

Step 1: Downloading and Installing OpenHAB on Pi

Its always good practice to be certain you are working with the latest updated software packages so lets begin with this:

sudo apt-get updatesudo apt-get upgrade

Certain apps may require you to update the firmware but typically its not a requirement. I suggest to do it anyway.

sudo rpi-update

You can use any kind of way that you would like to copy files to your Pi. I choose to do download them. I also like to download them directly to the folder that I will be extracting them from. I then do some housekeeping and remove the unnecessary zip file. First lets make the folders we need.

sudo mkdir /opt/openhab

You will then want to download the latest release to that folder. You can do that by going to the openHab downloads page and right clicking on the runtime core download and copying the link address to get the latest version. You can then replace the url below with the one you copied.

cd /opt/openhab

wget https://github.com/openhab/openhab/releases/download/v1.5.1/distribution-1.5.1-runtime.zip

Ok, lets install this b*tch. The zip files that you downloaded should be extracted to the correct location already. If your not already there go to the openhab folder and extract the runtime zip file there.

cd /opt/openhabsudo

unzip distribution-1.5.1-runtime.zip

Lets now remove the zip file which will no longer be needed.

rm distribution-1.5.1-runtime.zip

Great, the runtime is installed and the zip files erased, but in order for openHAB to work you will need to add bindings. Upon extrating the runtime zip a "addons" folder was created. All bindings belong in this folder. Go to the addons folder and extract the addons zip. First lets download them to the appropriate folder.

cd addons/

wget https://github.com/openhab/openhab/releases/download/v1.5.1/distribution-1.5.1-addons.zip

This contains all the bindings available for openHAB. As stated in the openHAB wiki, Bindings are optional packages that can be used to extend functionality of openHAB. By help of bindings openHAB users can e.g. access Asterisk communications software or connect to the KNX Home Automation Bus. 

Lets just install all of them and later we can sift through and decide which one we keep. You simply remove the .jar file from the addons folder.

sudo unzip distribution-1.5.1-addons.zip

Remove or erase the zip file.

rm distribution-1.5.1-addons.zip

Next lets go back one folder to the openhab folder and make a copy of the "openhab_default.cfg" file. You will call the copy "openhab.cfg". In the event that you have to update your openhab the default file will be updated as well. By making a copy of this file, openhab will use this file for configurations and also not update it. Since you will be making your own custom configurations, it is important that those get written in the "openhab.cfg" file for safe keeping.

cd ..

sudo cp configurations/openhab_default.cfg configurations/openhab.cfg

In order to understand how this crazy thing works I recommend deploying the demo app. Its a good way to get your foot on the ground and make some sense of this.

cd /opt/openhab

wget https://github.com/openhab/openhab/releases/download/v1.5.1/distribution-1.5.1-demo-configuration.zip

Go to the openhab folder and extract the demo zip files there.

cd /opt/openhab

sudo unzip distribution-1.5.1-demo-configuration.zip

remove the garbage files

rm distribution-1.5.1-demo-configuration.zip

By default the "start.sh" script is not an executable file. Do the following in order to make it executable:

sudo chmod +x start.sh

sudo ./start.sh

And the fun begins! You should have a fully loaded demo that you can use to familiarize yourself with openHAB. Just go to your telephone or computer and place the following url in your favorite browser. Be sure to replace the ip address with the Ip address of your Pi. 

http://192.168.X.XXX:8080/openhab.app?sitemap=demo