2016. március 28., hétfő

AutomaTales - Install OpenHAB

Now here I install OpenHAB as the home automation controller, the brain of the whole system.
The OpenHAB is a java based system, so first we need an Oracle Java. To achieve this you have to add a PPA repository to the system:
BTW. I know that the sudo voodoo is absolutely necessary to keep the security. Even I'm working on my windows machine as a standard user and not admin since XP when the UAC wasn't even planed. But when I put together something on linux or windows and what I'm doing is clearly administrative task, I'm doing it as admin. So the first thing when I install several things, packages, etc. on linux I start with

sudo su

And don't bother to write sudo at beginning of every single line.

1. Add PPA repository of the Oracle Java and install it.

apt-get install software-properties-common
add-apt-repository ppa:webupd8team/java apt-get update apt-get install oracle-java8-installe 

2. Download OpenHAB files. You will need this ones:

Actually I usually download the files on my Windows machine and transfer them to the linux via WinSCP

3. Extract the files, create configuration

mkdir /opt/openhab
unzip distribution-1.8.1-runtime.zip -d /opt/openhab/ unzip distribution-1.8.1-demo.zip -d /opt/openhab/ cp /opt/openhab/openhab_default.cfg /opt/openhab/openhab.cfg

4. As we still in sudo mode we can start the OpenHAB server to test the functionality of our system:


After waiting for a while, we can test in a browser if it works:

http://<ip address>:8080/openhab.app?sitemap=demo

OK. Our server works, but we not yet finished. Just stop it now.

First: you may realized that I didn't created any specific user for the openhab. There is a reason why.

The Ubuntu not really designed for embedded systems. Therefore no mechanism (what I'm aware of) for regular user to access GPIO (if you know a simple method for it please don't keep inside). On the next part I want to use GPIO. Based on this I plan to run OpenHAB as root.

Second: I need a method to run OpenHAB as daemon So..

5. Download the daemon script from here:


Save as openhab into the /etc/init.d folder
Configure it:

chmod a+x /etc/init.d/openhab
update-rc.d openhab defaults

Edit the file with your favorite editor. Most probably you only need to change the RUN_AS from openhab to root
Start it:

/etc/init.d/openhab start

Now you can check it again if it still works via a web browser, and you can check the /var/log/openhab.log for errors.

Nincsenek megjegyzések:

Megjegyzés küldése