Introduction: Install OpenHAB on Raspberry Pi

Install latest version of openHAB on Raspberry Pi and get the demo running. For many makers, the internet of things is all about home automation. openHAB is the leading open-source home automation hub.

I struggled with openHAB's installation instructions. Home Automation for Geeks' instructions helped me get an old version running (1.7). However, I wanted to install the latest stable version.

The instructions were verified with 1.8.3, but should work for any new stable version.

In general, raspbian and debian variants use packages enabling simple installation with apt-get. However, java is operating system independent and uses zip files for installation. openHAB has apt-get install, but it didn't work for me.

Notes:

  • Replace text enclosed in spades with an actual value ♣replace-this♣
  • Remove spaces around the colon (https : //)
  • Setup Raspberry Pi (any model) running raspbian or DietPi
  • I use a MacBook but any computer can be used. I think the only change if you are using a PC, is to use putty to login and open a terminal window.
  • My openHab Raspberry Pi is using ♣ip-address♣ = 192.168.1.100

Step 1: Step-by-Step Install

Step-by-step instructions follow, or go to the next step and use an unattended install to do the steps below.

Open terminal window and ssh into Raspberry Pi

$ ssh pi@♣ip-address♣

Always update and upgrade

$ cd ~/.
$ sudo apt-get update
$ sudo apt-get upgrade

Install java and eclipse

Check if java and eclipse are installed. If installed, then you should see /usr/bin/java or /usr/bin/eclipse. If not installed, install them

$ which java
$ sudo apt-get install oracle-java8-jdk -y 
$ which eclipse
$ sudo apt-get install eclipse -y

Install Mosquito

Remove the spaces around the colons.

$ wget http : //repo.mosquitto.org/debian/mosquitto-repo.gpg.key 
$ sudo apt-key add mosquitto-repo.gpg.key
$ rm mosquitto-repo.gpg.key
$ cd /etc/apt/sources.list.d/
$ sudo wget http : //repo.mosquitto.org/debian/mosquitto-jessie.list
$ sudo apt-get update
$ sudo apt-get install mosquitto mosquitto-clients

Test Mosquito

$ mosquitto_sub -d -t hello/world

Open a second terminal and ssh in

$ ssh pi@♣ip-address♣
$ mosquitto_pub -d -t hello/world -m "Hello from terminal window 2!"

The message from window 2 should appear in the first window.

Logout and close second terminal window.

CTRL-c in the first terminal window

Make directories

$ ssh pi@♣ip-address♣
$ sudo mkdir /opt
$ sudo mkdir /opt/openhab
$ sudo chmod -R ugo+rw /opt/openhab

Get links to latest version of openHAB

On MacBook (or PC):

  • open browser
  • open text file

In browser, go to openHAB downloads page and copy the following links to text file:

  • Runtime core
  • Addons
  • Demo setup

To copy a link on a MacBook, hold CTRL and click on link, then select Copy Link

Paste each link into text file. You will see something like this:

Download

CTRL-Click on Download and Edit Link. Select the link, copy it and paste it to text file. You will see something like this:

https : //bintray.com/artifact/download/openhab/bin/distribution-1.8.3-runtime.zip

Remember to remove spaces around the colon.

As of 27MAY2016, the current openHab links for the stable release 1.8.3 are:

♣runtime-core♣ = ♣https : //bintray.com/artifact/download/openhab/bin/distribution-1.8.3-runtime.zip♣

♣addons♣ = ♣https : //bintray.com/artifact/download/openhab/bin/distribution-1.8.3-addons.zip♣

♣demo-setup♣ = ♣https : //bintray.com/artifact/download/openhab/bin/distribution-1.8.3-demo.zip♣

Download latest version of openHAB

Run the following commands using links and names from above

$ cd /opt/openhab
$ sudo wget ♣runtime-core♣
$ ls
♣runtime-core-zip-file♣
$ sudo unzip ♣runtime-core-zip-file♣
$ sudo rm ♣runtime-core-zip-file♣

$ cd /opt/openhab/addons
$ sudo wget ♣addons♣
$ ls
♣addons-zip-file♣
$ sudo unzip ♣addons-zip-file♣
$ sudo rm ♣addons-zip-file♣

$ cd ..
$ sudo wget ♣demo-setup♣
$ ls
♣demo-setup-zip-file♣
$ sudo unzip ♣demo-setup-zip-file♣
$ sudo rm ♣demo-setup-zip-file♣
$ sudo chmod +x start.sh

Start openHAB running

$ cd /opt/openhab
$ sudo ./start.sh

openHAB takes about 5 minutes to start

In the browser, open a new tab and go to (remove spaces around colon):

http : //♣ip-address♣:8080/openhab.app?sitemap=demo

And it should work!

However, openHAB should really start and run on boot.

Stop openHAB

CTRL-z to stop openHAB. I haven't figured out how to recover from stopping openHAB. The only way to get openHAB to work after stopping is to reboot.

Add username and password

$ sudo nano /opt/openhab/configurations/users.cfg 

and add the following line, replacing names in spades with real values. Even though I am using diet-pi, I created a pi username.

user=password,user,role
♣username♣=♣password♣

Add MQTT binding

$ cd /opt/openhab/configurations
$ sudo cp openhab_default.cfg openhab.cfg
$ sudo nano openhab.cfg

CTRL-w to search for mqtt and uncomment the lines and edit to look like:

mqtt:broker.url=tcp://localhost:1883 
mqtt:broker.clientId=openhab

Use localhost and not your ♣ip-address♣. DHCP might change the ip-address and localhost will keep up with these changes.

CTRL-o, ENTER, CTRL-x to write and exit nano editor

Start openHAB on boot

Unless running an old version of raspbian, don't use init.d. Diet-Pi and raspbian use systemd, which is is a linux init system to bootstrap user space and manage processes. To check if systemd is being used, enter the command:

$ ps -p 1 -o comm=
systemd

Make system directory if it doesn't exist and create a start-up file

$ sudo mkdir /usr/lib/systemd/system 
$ sudo nano /usr/lib/systemd/system/openhab.service

And add

[Unit]
Description=openHAB Home Automation Bus
Documentation=http://www.openhab.org
Wants=network-online.target
After=network-online.target

[Service]
Type=simple 
GuessMainPID=yes
User=pi
ExecStart=/opt/openhab/start.sh
ExecStop=kill -SIGINT $MAINPID
Restart=on-failure
WorkingDirectory=/opt/openhab

[Install]
WantedBy=multi-user.target

To save and exit: CTRL-o, ENTER, CTRL-x

Change owner recursively on openhab.

$ sudo chown -R pi:pi /opt/openhab

Reload systemd to make the daemon aware of the new configuration.

$ sudo systemctl --system daemon-reload
$ cd /usr/lib/systemd/system
$ sudo systemctl enable openhab.service
$ sudo systemctl start openhab.service 
$ sudo reboot

Fix any issues in the logs. To see the log, enter the command:

$ sudo journalctl -f -u openhab.service

CTRL-c to stop

$ sudo reboot

openHAB takes about 5 minutes to start

In the browser, open a new tab and go to

http : //♣ip-address♣:8080/openhab.app?sitemap=demo

And it works!

Step 2: Unattended Install of OpenHAB Demo

Make openHAB Demo Installation very easy by automating the previous step using a bash unattended install script. The script assumes a raspberry pi running raspbian or dietpi, which was setup using one of the embedded links.

I finished the script on github and

  • tested the source on dietpi
  • tested unattended install script on dietpi
    • ran one time
    • ran multiple times, with CTRL-c interrupts
  • tested unattended install script on raspbian

The script assumes the username = pi, and the password = raspberry, and the script is trying to install openHAB 1.8.3. If these aren't correct, then edit the file accordingly.

Open terminal window on a MacBook or PC and run the following commands:

$ ssh pi@♣ip-address♣
$ sudo wget "https://raw.githubusercontent.com/dumbo25/install-openhab-demo/master/openhab_uai.sh"
$ sudo chmod o+x openhab_uai.sh
$ sudo bash openhab_uai.sh
$ sudo reboot

The script takes about ten minutes to run onraspbian.

Be sure to reboot the Raspberry Pi and wait 5 minutes until openhab starts

And it should work!

Once it works, be sure to change the hostname and password.

Comments

author
VaradarajanK made it!(author)2017-01-19

Got it. Used unattended install and it worked great. Thanks.

author
diy_bloke made it!(author)2016-12-17

Dont misunderstand, I think you did a great instructable, but after a few days experience with openhab, I get more and more frustrated by the application. Apart from what I mentioned earlier there is just another problem with it every time I try it. Not anything that I would trust my house to. Dont want to come from holiday home and find the heating up to 30 degrees, all the lights on and my alarm not functioning.
I sure hope your experience with it is better

author
jeff.cartwright.562 made it!(author)2016-12-17

I am a bit insane. Before I start on an instructable, I make a list of my requirements and then do a search for all possible solutions. Some solutions I throw out before I get too deep because they don't meet my requirements. Of those solutions remaining, I try to implement each one to some level. I'll start a draft instructable for each solution, and then at some point give up on it because it is more problematic than helpful. I then move on to the next one.

I am sorry that OpenHab is not working for you.

I found that OpenHab was confusing to install and get running, which is why I wrote the instructable. However, OpenHab meets my requirements and seems to be the most extensible home automation solution and works with my other home automation stuff: garage door opener, security system, Ring, Nest, OpenSprinkler, Echo, etc. I haven't done lights yet.

Yes, I agree there are issues. At about 2am one night, my garage door opened and then the security alarm went off when the door between the house and garage was apparently opened. However, I am still not sure what happened. Because my dog and I were up pretty quick and outside, but there was no one around. Did someone actually try to break in, or did something just go wrong in the code? I've put in some safeguards to prevent cached commands from being executed at unexpected times, and some more messages to log events if it happens again.

There are many other DIY solutions. And, if you want to try off-the-shelf, I lean towards Samsung's SmartThings Home Automation Hub.

author
diy_bloke made it!(author)2016-12-17

Jeff, thanks for your extensive reply. I want to be absolutely clear your install guide is the best I came across. That I have problems with openhab is absolutely not on your account.
I havent given up yet, so I may just wipe my entire TPi clean, do a fresh Raspi install and a fresh Openhab install and apart from Webmin put nothing else on it.

The people behind Openhab apparently agree that it has issues as one of the flash words for OH2 is 'less complicated to install' and 'less issues in running' (or similar words)
Not much of an 'off the shelf man' but if you have any other DIY suggestion, always interested to have a look.
Thanks again and enjoy yr day

author
diy_bloke made it!(author)2016-12-16

Great instructable. Tnx
yet I am till now not really trilled by the combo Raspberry and Openhab.
not sure which one of the two is unreliable.

After setting it up and getting it to work.
it needed frequent restarts,sometimes just the openhab sometimes both.
and then it stopped working giving me all sorts of errors on non queriable persistence modules (e.g. rr4dj) missing Mongo databases and what have you.

I am sure there is all a reason for it but I am a simple man. If at one moment it works and then stops and can't get it to work again then obviously it isnt very stable.
I am going to try a fresh install of Raspi and openhab and see where that brings me

author
TonyD87 made it!(author)2016-11-26

This is a classic example of "read the instructions" before you start because I did not realize there was a script that automated these steps. The script needs some modifcations so it was still good to go through the process and understand the different steps. I first used another instructable on installing openhab and the challenge I had was copying the configuration and addon files across the folders. I was directly connected so I used Terminal. Since that instructable enabled samba, I copied the files from a mac using Samba and then changed the owner properties. The wget function was easier I believe.

Several questions

- who should be the owner? pi or openhab?
- The openhab shows errors and warnings and I'm trying to understand if I should be concern since it is just a demo. I can open the site demo from a OSX and Windows but the app gives me a request failure, Internal server error (500). I copied the URL from the app to Safari on my phone and it works.

Finally, can you point to me on any openhab tutorials to start adding automation modules and beef up security? Thanks for taking the time and posting this instructable. It helped me!

openhab_demo.jpeg
author
TonyD87 made it!(author)2016-11-26

So I figured out why the mobile app wasn't working. I didn't need the last part of the URL; just the IP address or hostname with :8080 appended.

author
symr made it!(author)2016-11-04

my service not started... got some error msg, how do i solve this?

sudo journalctl -f -u openhab.service

-- Logs begin at Fri 2016-11-04 12:59:30 CET. --

Nov 04 12:59:36 HOMESRV systemd[1]: Starting openHAB Home Automation Bus...

Nov 04 12:59:36 HOMESRV systemd[1]: Started openHAB Home Automation Bus.

Nov 04 12:59:36 HOMESRV systemd[1]: openhab.service: main process exited, code=exited, status=200/CHDIR

Nov 04 12:59:36 HOMESRV systemd[1]: Unit openhab.service entered failed state.

Nov 04 12:59:36 HOMESRV systemd[1]: openhab.service holdoff time over, scheduling restart.

Nov 04 12:59:36 HOMESRV systemd[1]: Stopping openHAB Home Automation Bus...

Nov 04 12:59:36 HOMESRV systemd[1]: Starting openHAB Home Automation Bus...

Nov 04 12:59:36 HOMESRV systemd[1]: openhab.service start request repeated too quickly, refusing to start.

Nov 04 12:59:36 HOMESRV systemd[1]: Failed to start openHAB Home Automation Bus.

Nov 04 12:59:36 HOMESRV systemd[1]: Unit openhab.service entered failed state.

author
symr made it!(author)2016-11-04

Also trying to change the start.h following this instructions:

https://github.com/openhab/openhab/wiki/Samples-Tr...

it doesnt help.

service openhab status

● openhab.service - openHAB Home Automation Bus

Loaded: loaded (/usr/lib/systemd/system/openhab.service; enabled)

Active: failed (Result: start-limit) since Fri 2016-11-04 14:15:00 CET; 3min 53s ago

Docs: http://www.openhab.org

Process: 577 ExecStart=/opt/openhab/start.sh (code=exited, status=200/CHDIR)

Main PID: 577 (code=exited, status=200/CHDIR)

author
jeff.cartwright.562 made it!(author)2016-11-04

From your posts, it looks like you are trying things from other sites to get openhab to work. If you are trying my instructable and it does not work, I can help.

I believe the unattended install script will fix many problems, but I have not tried it on other people's instructions. Have you tried logging into your raspberry pi and running these commands:

$ ssh pi@♣ip-address♣

$ sudo wget "https://raw.githubusercontent.com/dumbo25/install-openhab-demo/master/openhab_uai.sh"

$ sudo chmod o+x openhab_uai.sh

$ sudo bash openhab_uai.sh

$ sudo reboot

Wait about five for the raspberry pi to boot and openhab to start. Open a browser on your laptop and enter:

http://♣ip-address♣:8080/openhab.app?sitemap=demo

Be sure to replace ♣ip-address♣ with the actual raspberry pi's ip address.

Can you run the following commands and post results?

$ cat /etc/*-release

$ uname -mrs

$ ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm"

Also, could you try the following command and post 100 or so lines to pastebin?

$ sudo journalctl -f

Finally, can you run this command and post the results:

$ /usr/lib/systemd/system/openhab.service

author
symr made it!(author)2016-11-07

Thanks for ur reply.

i followed your intructions, install the latest build of Jessie, turn on VNC and after that starting ur how to.

everything was ok except the last step installing as service

this is the last execute in terminal:

pi@HOMESRV:~ $ sudo systemctl start vncserver-x11-serviced.service
pi@HOMESRV:~ $ sudo chown -R pi:pi /opt/opanhab/
pi@HOMESRV:~ $ sudo systemctl --system daemon-reload
pi@HOMESRV:~ $ sudo systemctl enable openhab.service
pi@HOMESRV:~ $ sudo systemctl start openhab.service
Job for openhab.service failed. See 'systemctl status openhab.service' and 'journalctl -xn' for details.
pi@HOMESRV:~ $

currently i dont have time for reinstalling the whole openhab, because already using and configuring, testing some MQTT device on it.

Next time i will try the openhab_uai.sh install.

Here it is the other logs:

pi@HOMESRV:~ $ cat /etc/*-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@HOMESRV:~ $ uname -mrs
Linux 4.4.26-v7+ armv7l
pi@HOMESRV:~ $ ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm"
22 ? 00:00:00 kdevtmpfs
pi@HOMESRV:~ $ sudo journalctl -f
-- Logs begin at Tue 2016-11-08 00:34:16 CET. --
Nov 08 00:39:19 HOMESRV systemd[1]: Stopping openHAB Home Automation Bus...
Nov 08 00:39:19 HOMESRV systemd[1]: Starting openHAB Home Automation Bus...
Nov 08 00:39:19 HOMESRV systemd[1]: openhab.service start request repeated too quickly, refusing to start.
Nov 08 00:39:19 HOMESRV systemd[1]: Failed to start openHAB Home Automation Bus.
Nov 08 00:39:19 HOMESRV systemd[1]: Unit openhab.service entered failed state.
Nov 08 00:43:03 HOMESRV sudo[1174]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -f -u openhab.service
Nov 08 00:43:03 HOMESRV sudo[1174]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Nov 08 00:43:34 HOMESRV sudo[1174]: pam_unix(sudo:session): session closed for user root
Nov 08 00:44:53 HOMESRV sudo[1188]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -f
Nov 08 00:44:53 HOMESRV sudo[1188]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
pi@HOMESRV:~ $ /usr/lib/systemd/system/openhab.service
-bash: /usr/lib/systemd/system/openhab.service: Permission denied
author
jeff.cartwright.562 made it!(author)2016-11-08

There is typo in this line (it should be openhab):

sudo chown -R pi:pi /opt/opanhab/

Explains the permission denied, and the issue in the first part. Running the UAI script would avoid things like this.

author
wolexie made it!(author)2016-11-01

Thanks a million!

I have been struggling to get it to install and run for the past few days...

I am looking to connect an enocean module to my pi and everything integrated with openhab.

This is a great starting point for me.

Thanks again!

author
JamesK232 made it!(author)2016-09-05

Odd problem I don't know how to troubleshoot.

Before installing openhab using this instructable, my pi3 connected to my ethernet just fine. After installing but before adding openhab to the boot, all was still good (and openhab worked too!). Added the openhab.service segment and it stopped connecting. removed the openhab.service and now it only connects on every other reboot.

Boot message it is hanging on is: (works every other time)

A start job is running of LSB: Rais network interfaces.

How do I troubleshoot this one??

author
jeff.cartwright.562 made it!(author)2016-09-05

I am not sure I understand the issue. Is the Raspberry Pi hanging, or is your laptop unable to connect using a browser to OpenHab on the RPI? Please provide additional details.

This seems to be an incomplete statement: "Boot message it is hanging on is:" What is the message it is hanging on? A boot message seems like the raspberry pi is hanging.

Also, this doesn't look correct: "LSB: Rais network interfaces"

Are you using Wi-Fi or wired connection? If Wi-Fi on Pi3, how is it configured?

Are you using DietPi or Raspbian?

Did you try running the unattended install, it should fix whatever is wrong?

My wild guess is the openhab directory does not have the correct permissions. Some file in one of the sub-directories contains a file that cannot be read or written.

author
jeff.cartwright.562 made it!(author)2016-09-06

A couple more guesses:

* If all of the addons are installed, then it takes 5+ minutes for openhab to get to a stable state. Are you waiting long enough?

* If the raspberry pi is operating correctly, then it should work the same way on every boot. Can you measure voltage on the raspberry pi 5v and ground pins? If voltage fluctuates and drops below 4.9v, then the power supply is at issue.

author
santhosh+B made it!(author)2016-08-04

Hi, I am new to MQTT and openHAB. By following your instructions successfully installed MQTT and openHAB on Raspberry pi 3. Thank you for the instructions.

I would like to know how to send MQTT subscribed messages to openHAB. For example client running on rpi3 has subscribed to topic /home/light1. I would like to send this to openHAB and see the status in web browser. Please guide me.

author
jeff.cartwright.562 made it!(author)2016-08-11

You have jumped ahead of me. Try posting your question to this forum

https://community.openhab.org/t/openhab-mqtt-inbou...

This forum focuses on getting mqtt inputs & outputs to display in the browser.

author
boilermanc made it!(author)2016-08-11

Hi, great directions. Question though, once you get the service setup for the auto reboot start how do you stop just the openhab service? then how would you restart in debug mode? i need to check out the logs in debug mode.

thanks!

author
jeff.cartwright.562 made it!(author)2016-08-11

To stop after auto reboot, try:

$ sudo systemctl stop openhab.service

I have not used debug. However, I use this command to view logs:

$ sudo journalctl -f -u openhab.service

author
PieterB36 made it!(author)2016-08-03

But I must add, I have been playing around with OpenHAB a lot on Windows before installing it on my Pi.

author
jeff.cartwright.562 made it!(author)2016-08-03

Did you use PC or MAC?

author
PieterB36 made it!(author)2016-08-04

PC

author
PieterB36 made it!(author)2016-08-03

Excellent instructable. I installed my Pi and followed the OpenHAB steps.

Worked first time. Even the auto load after reboot.

Cant find anything wrong with this instructions. :-)))

author
jeff.cartwright.562 made it!(author)2016-08-03

Thank You.

author
kult0007 made it!(author)2016-07-05

I'm feeling like a lost n00b here. I can't even get the Demo setup to work. I've followed the instructions three times and each time it gets stuck in an endless install loop after I unzip the demo house and try to launch OpenHAB runtime. There are a number of warns and errors as the loop repeatedly fails. I'm using a Raspberry Pi 3.

I want to post a log file for the community to review. What log file should I post?

author
jeff.cartwright.562 made it!(author)2016-07-06

I am so sorry my instructable is not working for you.

It is hard to know what is going wrong. Did you run the chmod command below? If not, try it and then rerun the demo unzip steps.

$ sudo chmod -R ugo+rw /opt/openhab

Run

$ ls -l

total 808

drwxrwxrwx 4 pi pi 20480 Jun 30 19:43 addons

drwxrwxrwx 9 pi pi 4096 Jun 30 19:43 configurations

drwxrwxrwx 2 pi pi 4096 Jun 30 19:38 contexts

-rw-r--r-- 1 root root 666375 May 22 15:05 distribution-1.8.3-demo.zip

...

Did you use one of my instructables to setup raspberry pi, or a different set of instructions? If different let me know what you used, and I will try that.

If you installed raspbian, then look in these logs: /var/log/syslog, /var/log/dmesg, or /var/log/messages. The first should be the most useful. CTRL-C when it gets stuck in the loop and run: tail /var/log/syslog.

If you installed DietPi, you will have to login as root, and run dietpi-software, select 5 Log System, and then select Full Logrotate and Syslog. After enabling full logging, you should be able to see the logs above.

Please let me know which linux dist (dietpi or raspbian) and the version you are using, and I will try to repeat the problem you are having.

Post the results of ltail /var/log/syslog

From your description it is getting stuck here:
$ cd ..

Note: remove spaces around colon in the wget command below.

$ sudo wget https : //bintray.com/artifact/download/openhab/bin/distribution-1.8.3-demo.zip

$ ls distribution-1.8.3-demo.zip

And specifically, on the following instruction:

$ sudo unzip distribution-1.8.3-demo.zip

Your commands ($) should look like those above. Correct?

The "cd .." should take you to /opt/openhab. You might try cd /opt/openhab, and then pwd to confirm. Grasping at straws here, but the $ should not be cut-and-pasted, it is the command prompt.

author
kult0007 made it!(author)2016-07-06

The dmesg log was empty and the messages log just looked like kernel initialization operations. The syslog may be interesting, but I don't exactly what I'm looking for. I posted the syslog on pastebin:

http://pastebin.com/gCaTq9Pp

I'll continue to investigate, and I appreciate any insight you may have because I'm eager to learn. Every new challenge I run into ends up teaching me several lessons I didn't know I needed to learn! Thanks in advance for your help :-)

author
jeff.cartwright.562 made it!(author)2016-07-07

Thank you for the data. The history looks correct. I do not see anything in the logs that jumps out. However, I am not an expert at scanning logs. I usually grep for: fail, warning or error in the log and try to fix those. I assume you are launching openhab runtime by running commands:

$ cd /opt/openhab
$ sudo ./start.sh

There are several fail, warning and error in the logs posted, but I don't think they are causing start.sh to get in an endless loop. As soon as wrote this, I realized start.sh runs in an endless loop. Please note start.sh will run forever, and you may see fails, errors and warnings. In general, these can be ignored. Once start.sh is running, wait about 5 minutes, open a browser on a laptop (not on the raspberry pi, and in the url box enter:

http : //♣raspberry-ip-address♣:8080/openhab.app?sitemap=demo

You should see something like the image on this instructable.

If not, can you run the following commands and post results?

cat /etc/*-release

uname -mrs

ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm"

Also, could you try the following command and post 100 or so lines to pastebin?

sudo journalctl -f

author
kult0007 made it!(author)2016-07-07

Success! For whatever reason it worked this time. Thank you so much for helping out! I learned some new concepts thru this experience. :-)

author
jeff.cartwright.562 made it!(author)2016-07-07

Yeah ! Many of the errors and warnings in start.sh and the long start-up time are caused by including everything in the addons directory. I'll fix this.

author
jeff.cartwright.562 made it!(author)2016-07-06

ltail /var/log/syslog should be tail /var/log/syslog

author
jeff.cartwright.562 made it!(author)2016-07-06

Can you login to your raspberry pi and run

$ history

and post the last 100-200 commands?

author
kult0007 made it!(author)2016-07-06

pi@raspberrypi:/ $ history

1 sudo apt-get update

2 sudo apt-get upgrade -y

3 sudo raspi-config

4 mosquitto_pub -d -t hello/world -m "Hello from terminal window deuce!"

5 exit

6 which java

7 whereis java

8 which eclipse

9 sudo apt-get install eclipse -y

10 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key

11 sudo apt-key add mosquitto-repo.gpg.key

12 rm mosquitto-repo.gpg.key

13 cd /etc/apt/sources.list.d/

14 sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list

15 sudo apt-get update

16 sudo apt-get install mosquitto mosquitto-clients

17 mosquitto_sub -d -t hello/world

18 sudo mkdir /opt/openhab

19 cd /opt/

20 cd /openhab/

21 sudo mkdir /opt/openhab

22 cd openhab/

23 cd ..

24 sudo chmod -R ugo+rw /opt/openhab/

25 ls

26 cd home/pi/Downloads/

27 ls

28 exit

29 cd /opt/openhab/

30 sudo wget https://bintray.com/artifact/download/openhab/bin/distribution-1.8.3-runtime.zip

31 ls

32 sudo unzip distribution-1.8.3-runtime.zip

33 sudo rm distribution-1.8.3-runtime.zip

34 cd /opt/openhab/addons/

35 ls

36 sudo wget https://https://bintray.com/artifact/download/openhab/bin/distribution-1.8.3-addons.zip

37 sudo wget https://bintray.com/artifact/download/openhab/bin/distribution-1.8.3-addons.zip

38 sudo unzip distribution-1.8.3-addons.zip

39 sudo rm distribution-1.8.3-addons.zip

40 cd ..

41 sudo wget https://bintray.com/artifact/download/openhab/bin/distribution-1.8.3-demo.zip

42 sudo unzip distribution-1.8.3-demo.zip

43 sudo rm distribution-1.8.3-demo.zip

44 sudo chmod +x start.sh

45 sudo ./start.sh

46 ls -l

47 cd ../..

48 ls

49 ls -l

50 sudo nano /var/log/syslog

51 tail /var/log/syslog

52 history

author
TAndL1 made it!(author)2016-06-30

I get through updating Mosquitto. When I try to run sudo apt-get install mosquitto mosquitto-clients, I get unmet dependency error below. Please help.

You might want to run 'apt-get -f install' to correct these:

The following packages have unmet dependencies:

libice-dev : Depends: x11proto-core-dev but it is not going to be installed

libsm-dev : Depends: x11proto-core-dev but it is not going to be installed

libxau-dev : Depends: x11proto-core-dev but it is not going to be installed

mosquitto : Depends: libwebsockets3 (>= 1.2) but it is not installable

mosquitto-clients : Depends: libmosquitto1 (= 1.4.9-0mosquitto1) but it is not going to be installed

author
jeff.cartwright.562 made it!(author)2016-06-30

I checked. I do not use the linux GUI and ignore the x11 messages. Check to see if you can send a message using mosquitto. If you can, and you don't use the GUI then you can ignore the dependencies.

The message (You might want to try...) is incorrect. You should use: sudo apt-get - f install...

If this doesn't work, try running the unattended install script. It should be able to run over whatever has already been installed. You will have to answer questions, choose A for All. And it should work.

author
TAndL1 made it!(author)2016-06-30

Then, when I try to resolve it by using the apt-get -f install command, I am greeted by:

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
author
TAndL1 made it!(author)2016-06-30

Thanks, I'll try that now.

author
LloydR9 made it!(author)2016-06-16

actually I looked back at the other instructable you are linked from and noticed it said to deploy in the openhab folder not in a demo one, so I have done. IT allows me to login/see the demo now.

Cheers

PS whats next? I'm new to all this. I have a nest some hue bulbs and a hub and want to start using this before I make anymore purchases.

L

author
jeff.cartwright.562 made it!(author)2016-06-16

After I got the demo working, I did a couple of things: #1) moved the add-ons to a sub-directory all_addons, #2) edited the sitemap to look more like my house, and #3) then got nest working (see this link https://github.com/openhab/openhab/wiki/Nest-Binding)

author
jeff.cartwright.562 made it!(author)2016-06-19

I am not sure which instructable I will make next. In openHAB, I have the following working: security system, irrigation system, and Nest thermostat. Things I have partially working, or think I could do better: networking (gateway, WiFi, switch), TVs and U-verse, laptops, and mobile phones. Things I don't have working: Ring, Echo (just got for father's day), and my raspberry pi projects (streaming media, server, garage door opener, etc.). Things I haven't purchased yet: Lights and wall Switches, automatic blinds, etc.

author
LloydR9 made it!(author)2016-06-17

ok cheers, I'm just walking through things again as I was looking at a makeusof site as well, on the hue and site maps!

Ill get there I'm sure.

I was using home-assistant but there seems to be more people on the openhab scene

Cheers

author
LloydR9 made it!(author)2016-06-16

Hi,

confused on the demo zip part. it goes in the main directory?

Also the mkdir section was missing the addons directory, or am I confused?

Cheers

author
jeff.cartwright.562 made it!(author)2016-06-17

demo goes in /opt/openhab

When addons or runtime is unzipped, it creates the addons directory

author
BarryE16 made it!(author)2016-06-15

Thanks for the info! Worked like a charm for me, I just had to make two small changes: I had to sudo apt-get update at the beginning because the eclipse install wasn't working, and I had to remove the slash before sitemap=demo on the URL.

author
jeff.cartwright.562 made it!(author)2016-06-15

Thank you. I made the changes above.

author
jeff.cartwright.562 made it!(author)2016-06-13

Thanks to burnels for some insightful changes. I made the changes above. Much appreciated!

author
Eloverphx made it!(author)2016-06-09

God tutorial. Followed it and worked! The only change that I saw was the MQTT config location. You have it in /etc/ instead of the installed location of /opt. unless we should copy it to that location and rename to openhab.cfg rather than openhab_default.cfg and move it to /etc?

author
jeff.cartwright.562 made it!(author)2016-06-10

Yes, you are correct it should be /opt not in /etc. I corrected. Thank you.

About This Instructable

24,206views

68favorites

License:

More by jeff.cartwright.562:My Cord Cutting SystemBuild Kodi / OSMC Infrared Receiver and Reset Hat for Raspberry PiAdd Adafruit's Ring LED Momentary Switch to Raspberry Pi
Add instructable to: