Start OpenHAB

"OpenHAB, How Cold Is It?"

On this page

Test It!

You start OpenHAB with this command:

sudo /opt/openhab/start.sh
This will take a minute or two to start up. When it's running it will add a line every 2 seconds when it receives new temperature info. If all went well it should look like this:

OpenHAB starting
OpenHAB starting up. You might not see the lines with [DEBUG] as those are optional and need to be enabled.

Now you can open a web browser at http://192.168.1.80:8080/openhab.app (replace 192.168.1.80 with your Pi's IP) and see the temperature update automatically!

Note 1: If the hareceiver program isn't running, open a second terminal window and start it. If your Arduino isn't plugged in, plug it in.

Note 2: You can exit OpenHAB using CTRL+C. This will also make the site unavailable again.

Auto Start On Boot

You'll probably want both OpenHAB and hareceiver to start up automatically when you reboot your Pi, so you don't have to worry about them. This is how:

sudo nano /etc/rc.local

Right before the last line ("exit 0") you add this:

# Run hareceiver
sudo /home/pi/rf24libs/hareceiver

For OpenHAB you'll need to paste the contents of this startup script into a file in /etc/init.d:

sudo nano /etc/init.d/openhab

Then make the script executable:

sudo chmod 777 /etc/init.d/openhab

Now you have access to a few useful commands for starting OpenHAB in the background, seeing the status, and stopping or restarting it:

sudo /etc/init.d/openhab start
/etc/init.d/openhab status
sudo /etc/init.d/openhab stop
sudo /etc/init.d/openhab restart

Make this script start up by default:

sudo update-rc.d openhab defaults

If you ever want to undo this, run:

sudo update-rc.d -f openhab remove

Now after you reboot your Pi both programs should be running. Remember OpenHAB needs a few minutes to start everything up.

Next

Now check our many other guides for ways you can expand on this core project

Guides