This receipe covers the installation of openHAB 2.0 on a Raspberry Pi model 3B+ or higher
Time to cook 120min
The combination of a low cost yet powerful board based on the Raspberry Pi with a proven open source automation platform based on OpenHAB are the perfect ingredients to build our Smart HUB
Raspberry Pi 3B+ (other versions might also work)
Power supply for Your Raspberry PI
SD card (16 GB Recommended) 8 GB Might also work
Raspberry Pi case
openHABian (free to download)
Etcher (free to download)
The Building Plan
Preparing your image
let’s burn the image on our SD card:
Go to the download section of the OpenHAB website
Select the Raspberry Pi as system on the download page.
Select the version you want to install. The choice is between Stable or Snapshot. choose stable for your production environment.
Download the Latest openHABian system image by clicking on the link as outlined in the image below
Once you have downloaded your openHABian image, you should flash it on an SD card for your Raspberry Pi. OpenHab proposes to use Etcher, which is a popular tool for burning your SD card. Just follow the instructions on the openHAB download page.
Next insert the SD card in your Raspberry Pi and boot it. The installation will take approx. 45 minutes.
Note: Best is to connect your Raspberry Pi to your home network using a LAN cable. You can use a WiFI connection if your Raspberry Pi supports it, but as the Raspberry Pi will be used as a main hub for connection all kinds of IoT devices and services, it will be more stable when it has a LAN connection and not depends on a less-stable WiFi connection.
When the installation is finished, you will be able to browse to your Raspberry Pi. OpenHAB has a frontend which you can reach on port 8080 and includes one or more applications, depending how you set up your device. verify your Internet modem to see which IP address your Raspberry Pi received and use that in your browser.
for example: http://your-ip-address:8080
If your raspberry pi got the IP address 192.168.0.18. you should enter: http://192.168.0.18:8080
You see the Initial Setup screen from openHAB 2. There are 4 pre-configured packages. The Standard package is the most recommended and good for our purpose.
After selecting the standard package you should see the following applications in the OpenHAB welcome screen. You might need to refresh your browser a few times and wait a bit until all applications appear.
Change the default password
After the installation of openHAB, the minimum you should do to secure your openHAB installation is change the default password of the openhabian user.
The default password is openhabian
You can do this as follows:
Login with the user openhabian using an ssh connection onto your Raspberry Pi
Enter your current password
Enter a new password for your account
This is it. You have executed your first recipe! The outcome is that you have a system which is ready to connect different kinds of sensors using different protocols.
The next section is optional, but highly recommended if you want to control your Smart HUB remotely or want to use a voice assistant.
Installing OpenHAB Cloud Connector
The openHAB Cloud Connector allows connecting the local openHAB runtime to a remote openHAB Cloud instance , such as myopenHAB.org , which is an instance of the openHAB Cloud service hosted by the openHAB Foundation .
The openHAB Cloud service (and thus the connector to it) is useful for different use cases:
It allows remote access to local openHAB instances without having to expose ports to the Internet or to require a complex VPN setup.
It serves as a connector to Google Cloud Messaging (GCM) and Apple Push Notifications (APN) for pushing notifications to mobile phone apps.
It brings integration possibilities with services that require an OAuth2 authentication against a web server, such as IFTTT or Amazon Alexa Skills
So, if you want to connect to your Smart HUB via the Internet, this is something you want to install. It is a secure way to connect to your Smart HUB from the Internet.
UUID and Secret
To authenticate with the openHAB Cloud service, you need to install the add-on in openHAB.
Open PaperUI from the openHAB url.
In the left menu, selct Add-ons
Select MISC in the top menu
Goto openHAB Cloud Connector
The add-on generates two values. These values need to be entered in your account settings of the openHAB Cloud service.
Location of UUID and Secret:
The first one is a unique identifier, which allows you to identify your runtime.
You can think of it as something similar like a username for the cloud authentication. The second one is a random secret key which serves as a password. Both values are written to the local file system. If you lose these files for some reason, openHAB will automatically generate new ones. You will then have to reconfigure UUID and secret in the openHAB Cloud service under the My account section.
Next, Goto myopenhab.org and register/login an account.
When talking to people that want to set up their home automation system at home, they are very suspicious to open their systems to others, which is quite understandable. On the other hand, to build a system-of-systems approach and get the most out of it, you need to peer with other systems.
You can (and should) limit the access to third party systems. This can be done by only expose the items you want to share with the other platforms. You can do this in OpenHAB in the Paper UI under Configuration -> Services -> IO -> openHAB Cloud:
Alternatively, you can configure the settings in the file conf/services/openhabcloud.cfg.
Configuring a static IP address for your Smart HUB
Most home network routers provide a DHCP address. This means that the router will distribute an IP address to IP capable devices within a certain range. The advantages is that you don’t have to set it up manually, but the disadvantage is that this IP address might change in future (when the lease expires). This behavior is something you might want to avoid on your Smart HUB especially if you would refer to it’s IP address in a system-of-systems architecture.
To assign a static IP address to your Raspberry Pi, proceed as follows:
Login with the user openhabian using an ssh connection onto your raspberry pi
Edit the dhcpcd.conf file
sudo nano /etc/dhcpcd.conf
Scroll all the way to the bottom of the file and add the following lines of code
Note: You’ll need to edit the numbers in the snippet so they match your network configuration
interface = This defines which network interface you are setting the configuration for.
static ip_address = This is the IP address that you want to set your device to. (Make sure you leave the /24 at the end)
static routers = This is the IP address of your gateway (probably the IP address or your router)
static domain_name_servers = This is the IP address of your DNS (probably the IP address of your router). You can add multiple IP addresses here separated with a single space
To exit the editor, press ctrl+x
To save your changes press the letter “Y” then hit enter
Now all you need to do is reboot, and everything should be set!
sudo reboot -h 0
You can double check by typing
And checking the interfaces IP address
A good next step is to add some devices to your Smart HUB. Have a look at recipe ‘Using Zwave devices’.