Installing OpenHAB

To install and run OpenHab on your Pi I am recommending you use the apt-get approach, these instructions are taken from the OpenHAB Wiki, so it may be more up to date and have additional options. I also contribute to changes in the wiki every now and then so this may get out of date but in general be correct. This page does highlight the addons needed for the guides on my site. Shopping List - things you need to do this.

Just a Raspberry Pi for this, I still use V1 B+ as I have not needed to get a V2 yet. This pack has everything you need to get started.

  1. Install Java if 1.6 or higher is not already installed. The following will display your current Java version.

    java -version
    
  2. Add the openHAB Bintray Repositories key to the apt-keyring using wget:

    wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
    

    or using curl:

    curl 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
    
  3. Add openHAB apt repository to the apt sources list (Note: the current openhab.list file will be overwritten)

    echo "deb http://dl.bintray.com/openhab/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/openhab.list
    
  4. Resynchronize the package index

    sudo apt-get update
    
  5. Install the openHAB runtime

    sudo apt-get install openhab-runtime
    
  6. If you have more than one OpenHAB binding with a USB device (Z-Wave, RFXCOM, etc), refer to [[symlinks]]

  7. Start openHAB - manually

    1. Init based on sysVinit (e.g. Debian 7 / Ubuntu 14.x and earlier)

      sudo /etc/init.d/openhab start
      sudo /etc/init.d/openhab status
      
    2. Init based on systemd (e.g. Debian 8 / Ubuntu 15.x and higher)

      sudo systemctl start openhab
      
  8. Start openHAB - at system startup

    1. Init based on sysVinit

      sudo update-rc.d openhab defaults
      
    2. Init based on systemd

      sudo systemctl daemon-reload
      sudo systemctl enable openhab
      
  9. Install the add-ons / bindings as you need them. To follow these guides install the addons below. Feel free to add any other you may need or want.

    sudo apt-get install openhab-addon-${addon-type}-${addon-name}
    

    Install these addons:

    sudo apt-get install openhab-addon-binding-http
    sudo apt-get install openhab-addon-binding-ntp
    sudo apt-get install openhab-addon-binding-weather
    sudo apt-get install openhab-addon-binding-zwave
    sudo apt-get install openhab-addon-persistence-logging
    sudo apt-get install openhab-addon-persistence-rrd4j
    sudo apt-get install openhab-addon-binding-mqtt
    sudo apt-get install openhab-addon-binding-exec
    sudo apt-get install openhab-addon-binding-squeezebox
    sudo apt-get install openhab-addon-binding-xbmc
    

    A list of all available packages can be retrieved with

    sudo apt-cache search openhab
    
  10. Configure your system as outlined here: configuration.

  11. If you wish to use a USB zwave stick or other USB/serial device you will need to add the “openhab” users to the “dialout” group:

    sudo usermod -a -G dialout openhab

and then reboot.
  1. Test it, point your browser to http://localhost:8080/openhab.app?sitemap=yourname and you should see your sitemap. Replace localhost with the IP of your Pi if you are running headless.