The openHAB 4 appliance is an all in one system combining the openHAB 4 server based on openHABian with a lightweight touchpanel solution based on HABpanel on a Raspberry 4 to control your house, in a case that also gives home to the original Raspberry touchpanel. If you already run an openHABian based openHAB 4 installation on a modern Raspberry Pi you can upgrade it following just the parts of this tutorial beyond the installation of openHABian. But, you can take a backup of an existing openHABian based server, too, to install a new Pi or start from scratch, by following the tutorial completely. If you already own a running system, I would highly suggest making a backup of the SD-card first, so that you can return to that, if anything went wrong during the further steps.
The part of the touch client GUI of the openHAB 4 appliance is based on an article in the ct magazin 12/22 p. 160 “Raspi als wartungsarmes Kiosksystem“. I choose HABpanel as a frontend, but you can use every GUI you want, as long as it is web based with this solution.
For earlier versions, I used the official Raspberry case.
My latest version uses the SmartiPi Touch 2 case that has three advantages.
- While the original case demands a bottom up installation of the touchscreen that leads to a reduced picture quality, the SmartiPi case takes the screen in the correct orientation.
- It also allows adjusting the screen.
- There are two backpanels available with more or less space for some additional hardware. E.G. I use the Razberry hat attached to the GPIO-Pins of the Raspberry for z-wave instead of an USB don-gle to keep it compact.
openHABian is not intended as a basis for „something else“ and therefore not supported if you use it for „something else“ by adding a user interface or anything else on the same machine. If you follow this tutorial, you will have to take care of any additional components in the future by yourself and there could be situations in which an update via openHABian could interfere with the additional components you installed for your openHAB appliance or vice versa. So as always: Make backups!
Since openHAB 1.8 I built such devices for myself, first from scratch, now based on openHABian, and they work well as long as you do not put too much load on the system. My actual appliance is based on a Raspberry 4 with 4GB.
If you need additional touch terminals in the house to control openHAB you can use the minimal image of Pi OS without GUI instead of the openHABian image on an old Pi and follow this tutorial leaving out the parts specific to the openHAB server.
- Raspberry Pi (take advantage of a fast modern model with more memory, my model 4 with 4 GB works well)
- Original Raspberry touchscreen
- Original Raspberry case or SmartiPi case or similar solutions for Pi, screen and additional components
Attention: As there is no access to the SD-card slot after the Raspberry Pi is installed in the case, do not install the components in the case before everything works as expected! Use a “flying” setup of the hardware components instead for installation by connecting the touch screen and additional wanted components like the Razberry z-wave hat to the Raspberry Pi lying on a nonconductive surface (the box of the touchscreen can be used as a stand for it) and take care of static electricity by grounding yourself. There are different wiring options for the touchscreen. With the original case comes a short USB cable to daisy chain from the screen to the Raspberry. The power supply is connected to the interface board of the screen. With the SmartiPi you get a Y-cable to connect the screen and the Raspberry in parallel to the power supply. Install the cable for the power to the screen and the Raspberry now, but do not power on the system yet.
- Power supply with enough power for Pi, screen and additional components
- SD card (use a high quality manufacturer and an “endurance model” as always requested for use in a Raspberry, as you hardly will find a card below 32 GB these days, size does not matter)
- A PC (I use and describe using a Windows PC) connected to the internet with a reader/writer for SD cards and a SSH client like Putty and an editor like Notepad++ installed.
Open https://www.raspberrypi.com/software/ and download the Raspberry Pi Imager for your OS.
Install the Raspberry Pi Imager and start it.
If you want to build the appliance: Under OS choose “other specific-purpose OS” first and then “Home assistants and home automation” and finally “openHAB”. This tutorial is based on the 32-bit version of the image; the 64-bit version was not tested, so go for the 32-bit version, if in doubt.
If you want to build a touch client only, choose “Raspberry Pi OS (other) first and then Raspberry Pi OS light (32-bit)
Put your SD-card in your SD-card reader/writer and choose it as the SD-card to use in Pi Imager and then click on “Write”.
After the Pi Imager has finished writing the SD-card, close it, open a file browser and go to the SD-card. It’s first partition is named “boot”, now and can be accessed under windows, too.
To install the openHAB 4 appliance: Open openhabian.conf with an editor and change the name of the server to install to your needs, if you want.
timezone=Europe/Berlin locales="en_US.UTF-8 de_DE.UTF-8" system_default_locale="de_DE.UTF-8"
you can define settings for localisation of the system to be installed.
If you would like to connect to your new server via Wifi you can enter the data of your Wifi, too, under:
wifi_ssid="" wifi_password="" ... wifi_country=""
If you want to use a backup of an already existing openHABian installation, you can copy the backup ZIP-File to the boot partition of the SD-card, rename it to initial.zip and uncomment the following line
Save your changes and exit the editor. If you would like to change other settings please refer to the openHABian documentation https://www.openhab.org/docs/installation/openhabian.html.
Attention: You can also change the password for the openhabian user here. But that did not work (at least in the last version I tested), so stay with the standard here and change the password later.
If you use the original Raspberry Pi case in which the screen is installed bottom up you have to open config.txt and add the following line under Display setting:
Save the change and leave the editor.
Hint: If you get yellow flashes on your screen indicating low power from the power supply but your system runs stable, you can also add a line
Now take the SD-card out of your PC and put it in the Raspberry Pi. Attach the power supply and the LAN cable (if you use a wired LAN) and if you want to perform the following steps directly from the Rasberry, a keybboard and a mouse (I prefer using SSH to connect from my PC using a SSH-Client like putty) and the installation process of openHABian (or Pi OS for a pure touch client) will start. Wait until the installation progress has finished and you are able to log in to the system after an automatic reboot has occurred.
If you did not connect a keyboard and a mouse to your Rasberry, open a SSH session to your new server by using the server name previously given (or the standard openhabian, if not changed). Log in with the standard credentials for openHABian (user openhabian, password openhabian)
Start the openHABian config menu with
Go to „30 System Settings“ and „34 Change passwords“ to change the password for the openHABian user first.
If you use the Razberry z-wave hat, go to „30 System Settings“ and “35 Serial port“ and activate the options serial console and Bluetooth to be able to use the Razberry.
Now reboot the system to activate all the changes.
If you did not use a backup of a configuration of an already existing openHAB server as include.zip above and also do not want to restore a backup manually now within openhabian-config, now is the time to install the bindings you need, add the devices you have as things, connect items to the channels of the thing, representing its functions, and take care of a first GUI. Note the name and path of the page you would like to show as the homepage of your home automation touch panel for later.
First, we need a GUI-User with limited rights on the system that logs in automatically every time the system is started. We call it kiosk and give it a password
sudo useradd -m kiosk sudo passwd kiosk (openhabian_kiosk)
To make this user log in, every time the system boots up in the future
sudo mkdir – p [/email@example.com](mailto:/firstname.lastname@example.org) cd [/email@example.com](mailto:/firstname.lastname@example.org)
Now we have to change the config
sudo nano override.conf
You need a line as follows under
[Service] ExecStart=/sbin/agetty --skip-login --login-options "-f kiosk" %I 38400 linux
Save changes and leave the editor (in nano + to write the changes to the file and then + to exit)
The last thing you need is a .hushlogin file:
cd /home/kiosk touch .hushlogin
Now it is time to install openbox
sudo apt install --no-install-recommends xserver-xorg x11-xserver-utils xinit firefox-esr-l10n-de openbox –y
To configure it for our needs
cd /etc/xdg/openbox sudo nano menu.xml
Edit the file that it looks as follows:
<?xml version="1.0" encoding="UTF-8"?> <openbox_menu xmlns="http://openbox.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openbox.org/ file:///usr/share/openbox/menu.xsd"> <menu id="root-menu" label="Openbox"> <item label="Web browser"> <action name="Execute"><execute>x-www-browser</execute></action> </item> </menu> </openbox_menu>
Save your changes and leave the editor.
To set the language for displaying messages, … you can edit the environment file
sudo nano environment
Change the settings to your needs, for example:
# # Set system-wide environment variables here for Openbox # User-specific variables should be placed in $HOME/.config/openbox/environment # # To set your language for displaying messages and time/date formats, use the following: LANG=de_DE.UTF8 # To set your keyboard layout, you need to modify your X config: # http://www.google.com/search?q=how+to+set+keyboard+layout+xorg
Now, to be able to start openbox, we have to add the kiosk user to the video group:
sudo usermod -a -G video kiosk
To get openbox started automatically
cd /home/kiosk sudo nano .profile
At the end of the file add:
echo "Waiting 3 Minutes for the openHAB server to start before desktop is started ..." sleep 240 exec startx -- -keeptty >~/.xorg.log 2>&1
to give the openHAB server enough time to start up before the GUI is loaded. You may have to optimize the number of seconds to wait in the sleep command depending on your individual system. Do not be too short with this delay. Otherwise, the browser will not be able to open the webpage of your GUI and you will just get an error message instead, stating that the page could not be found.
Finally let openbox know what should be started inside it at start:
cd /etc/xdg/openbox sudo nano autostart
At the end of the file a line like the following is needed:
firefox http://192.168.0.249:8080/habpanel/index.html#/view/Homeautomation --kiosk &
whereas firefox means the firefox webbrowser. The following part describes the page and its view to load within firefox. In my case it is a HABpanel named Homeautomation which was previously configured within HABPanel and saved on the server in the default location under the IP of the server using port 8080, which is the default port for the openHAB GUIs under the path and view
Give your system a final reboot and it should come up with the openHAB server first and then starts the GUI.
Openbox in this tutorial is configured for turning off the screen after a while and reactivating it by a touch to save energy and to protect the screen.
A final note: There have always been discussions on (not) adding a GUI to an openHAB server. These are well understood and there is no need to start them again. There are also enough alternatives for a touchpanel to use with openHAB based on all different kinds of devices and noone has to use a Raspberry. But I wanted to do it, I did it, it works and perhaps others would like to do the same.