Eiko Wagenknecht
Software Developer, Freelancer & Founder

Installing openHAB 2 on Raspberry Pi (openHABian)

Eiko Wagenknecht

This post explains how to install the home automation software openHAB on a Raspberry Pi. At the time of writing, openHAB version 2.5.1 is current. For a guide on openHAB 3, you can find it here.

Table of Contents

Required Materials

1) Downloading and Installing the Required Software

To install openHAB on a Raspberry Pi, you need 3 downloads:

  1. The openHABian image (https://github.com/openhab/openhabian/releases/latest)
    • When downloading the openHABian image, you need to get the .img.xz file (not .zip)
  2. Etcher (https://www.balena.io/etcher/) for writing the image to the SD card
  3. Putty (https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) for connecting via SSH
    • Depending on your system, you’ll likely need the 64-bit MSI installer

After downloading, install Etcher and Putty.

2) Writing the Image to the SD Card

To write the image to the SD card, first connect the card with the card reader to your computer. Then start Etcher and select the downloaded .img.xz file in the first menu item and the SD card in the second item. The “Flash!” button starts the process.

3) First Start of openHAB

The completed SD card can now be inserted into the Raspberry Pi, which should then be connected to the network cable and power (in that order!). This boots up the system and performs several configuration steps in the background. During this process, new versions are downloaded from the internet, installed, etc. Depending on your connection speed, this can take a while. For me, it took about 20 minutes. During this time, there is no progress indicator. It is important not to disconnect power from the Raspberry Pi during this time… just wait!

You can tell that this step is complete when the welcome page appears at the URL http://openhab:8080:

4) Basic Configuration of openHAB

Now, we don’t continue in the web interface, but rather via SSH in the command line of the system to make some basic settings.

To do this, we connect to the system via Putty. It can be reached at:

Host: openhab, Port: 22 User: openhabian, Password: openhabian

The openhabian-config tool is used for configuration, which is started with root rights via the command “sudo openhabian-config”. The password is still “openhabian”.

There are now several settings to configure. You navigate between menu items using TAB and the arrow keys, and confirm with ENTER.

First, in the “System Settings” section under “Set System Timezone”, set the timezone, probably to your local timezone:

Also under “System Settings”, you can set a new password. This is highly recommended, otherwise anyone on the network can access and modify the complete openHAB configuration. The setting is in the “Change Passwords” submenu. It’s best to select all services there (use the space bar to set checkmarks) and then enter and confirm the new password:

5) Optional: Activating the Karaf Console

For many administrative possibilities, openHAB offers its own console, the so-called “Karaf” console. It is accessible via SSH in parallel to the normal SSH shell, but on a different port (8101). For it to be accessible from the network, access must be enabled.

This is done in the “openHAB related” menu under “Remote Console”. There you have to enter a password again (best to use the same as above).

To test if the setting was successful, you can now establish a connection with Putty.

Host: openhab, Port: 8101 User: openhab, Password: as just set

6) Optional: Setting a Static IP Address

Some use cases require openHAB to run with a static IP address. Therefore, it makes sense to set this now. The easiest way to do this is if you have a FritzBox or a router with similar functionality. Then the IP can simply be configured there as a static DHCP lease, in the case of the FritzBox with the checkbox “Always assign the same IPv4 address to this network device.”

7) Restarting openHAB

For all settings to take effect, you should execute the command “sudo restart” in the normal SSH console afterward.

8) Settings in the Web Interface

Now, finally, it’s time to access the web interface again at http://openhab:8080. There, you first need to select which startup configuration you want to begin with. I chose “Standard”. But don’t worry, everything can still be adjusted later.

After clicking, you’ll need to wait again - once more without a progress indicator - until the interface shows the following tiles:

By clicking on “PAPER UI”, you access the actual interface where we can make some settings. To do this, we click on Configuration > System.

The settings are always saved block by block. It is therefore important to always use the SAVE button next to the changed settings, otherwise the settings will be lost immediately.

After a new installation, I configure the following areas:

You’ll need to replace the exact values with ones appropriate for you. I configured it like this:

Somewhat hidden, there is a second settings menu with exactly one setting, namely the language. You can find it under Preferences in the menu and can switch to German there if you want. Unfortunately, the openHAB interface is not yet localized, so this only affects some add-ons. Here, you need to save with the blue check mark in the top row.

Conclusion

That’s it, openHAB is now installed and operational. Further configuration can now begin!

I look forward to your comments on whether this article helped you. Feel free to write if you have questions or if something remained unclear. Or if you were able to implement exciting automation projects based on this setup 🙂

No Comments? No Problem.

This blog doesn't support comments, but your thoughts and questions are always welcome. Reach out through the contact details in the footer below.

Support Me

If you found this page helpful and want to say thanks, you can show your appreciation by using this link for your next purchase on amazon.com. As an Amazon Associate I earn from qualifying purchases. I get a small commission, and it costs you nothing extra. You can also sponsor me on GitHub here.