Introduction: Setup of OpenHAB2 on a Raspberry Pi
This project was inspired by others in the community. When I went to start the setup process of installing openHAB2 on a raspberry pi I found a lot of issues with other documentation. These instructions will walk you through the process that I did in order to get the openHAB server up and running on a rasberrypi3. It will also be my intent to add in other home automation projects to share with you all.
Step 1: Step 1: Initial Setup of Raspberry Pi
So to start it all off, you first need to get a clean and updated version of Raspian installed on your Pi. Once you have am updated version of Raspian running on your Pi (please see other instructables for that, it is fairly straight forward), you will need to manually update to the latest version of Java. We need to have a java version of 1.8.0_100 or greater for certain aspects of openHAB2 to function properly. The following code will allow you to update your Pi.
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get install oracle-java8-installer
Now a reboot will be required. Once that reboot is done check the version of Java to ensure that it is greater than _100 (you can simply type java -version in the terminal).
Now that the Java version is proper, we can start to install and configure openHAB2 on your Pi.
Step 2: Step 2: Downloading and Installing OpenHAB2
The following code will allow you to download the files needed for the openHAB installation:
wget -qO -'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' |sudo apt-key add -
echo 'deb http://dl.bintray.com/openhab/apt-repo2 unstable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
sudo apt-get update
Now you can install openHAB via the apt-get command:
sudo apt-get install openhab2
Now the add-ons:
sudo apt-get install openhab2-addons
Now we enable the services as well as start them:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable openhab2.service
sudo /bin/systemctl start openhab2.service
sudo /etc/init.d/openhab2 start
And finally we can check the status of the openHAB service by running the following:
sudo /etc/init.d/openhab2 status
Now the final update and the server should be good to go:
sudo update-rc.d openhab2 defaults
To ensure that the server is running properly, you can open up your favorite browser and go to http://YOUR-PIs-IPADDRESS:8080 and you should see the startup screen of the openHAB service.
We have a be nice policy.
Please be positive and constructive.