Configuration - openHAB 2

We configure the openHAB2 automation platform.

To run the platform server, you must have java.

$ sudo apt-get install oracle-java8-jdk

First we will load the installation packages.

$ sudo mkdir /opt/openhab2
$ cd /opt/openhab2
$ sudo wget
$ sudo unzip

The add-on package is now installed directly from the platform interface. For initial configuration, you must run the server startup.

$ sudo ./ 

If the automation platform starts successfully, the openHAB console appears.

Launching the openHAB runtime...

                          __  _____    ____      
  ____  ____  ___  ____  / / / /   |  / __ )     
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  | 
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /      
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/     
    /_/                        2.0.0
                               Release Build   

Hit '' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '' or type 'system:shutdown' or 'logout' to shutdown openHAB.


Launch the browser and specify the address of the openHAB server http: //a.b.c.d: 8080.
The initial system installation window opens. We select the recommended installation "Standart".
After the installation is complete, go to the configuration interface "PAPER UI"
Choose the menu "Add-ons" and install the necessary add-ons.

  • "BINDINGS" - "Exec Binding"
  • "PERSISTENCE" - "RRD4j Persistence"
  • "TRANSFORMATIONS" - "Exec Transformation" и "RegEx Transformation"
Go to the console and stop the server by pressing the key combination Ctrl + d

Create a configuration file for information sources.

$ sudo nano conf/things/_default.things 
Thing exec:command:devrm_t [command="/opt/broadlink/", interval=60, timeout=5]
Thing exec:command:devrm_a [command="/opt/broadlink/ /opt/broadlink/code/rm1_a", interval=0, timeout=2, autorun=false]
Thing exec:command:devrm_d [command="/opt/broadlink/ /opt/broadlink/code/rm1_d", interval=0, timeout=2, autorun=false]

Create a device configuration file.

$ sudo nano conf/items/_default.items
String devrm_t "Temp RM2 [%s °C]" {channel="exec:command:devrm_t:output"}
Switch devrm_a {channel="exec:command:devrm_a:run"}
Switch devrm_d {channel="exec:command:devrm_d:run"}
Number Temp_period

Create the UI configuration file.

$ sudo nano conf/sitemaps/_default.sitemap
sitemap default label="My Smart Home" {
 Frame label="Smart Switch" {
  Text item=devrm_t icon="temperature"
  Switch item=devrm_a label="Button A" icon="switch" mappings=["ON"="A"]
  Switch item=devrm_d label="Button D" icon="switch" mappings=["ON"="D"]
 Frame label="Temp Chart" {
  Selection item=Temp_period icon="chart" label="Period" mappings=["0"="8 hours", "1"="Day", "2"="3 days", "3"="Week"]
  Image url="" visibility=[Temp_period==0]
  Image url="" visibility=[Temp_period==1]
  Image url="" visibility=[Temp_period==2]
  Image url="" visibility=[Temp_period==3]

Create a configuration file for the storage system.

$ sudo nano configurations/persistence/rrd4j.persist
Strategies {
        everyMinute     : "0 * * * * ?"
        default = everyChange
Items {
        devrm_t : strategy = everyChange, everyMinute, restoreOnStartup

Configuring and adding openHAB 2 to the system startup.

Create a service start script.

$ sudo nano /lib/systemd/system/openhab2.service 
Description=The openHAB 2 Home Automation Bus Solution

ExecStart=/opt/openhab2/ server
ExecStop=/bin/kill -SIGINT $MAINPID


Save the script and add it to the system startup.

sudo systemctl daemon-reload
sudo systemctl enable openhab2.service

Reboot the system. After rebooting in the browser, open the address http://a.b.c.d:8080, where a.b.c.d is the IP address of Raspberry Pi. Go to the "BASIC UI" configuration interface. If everything is configured correctly, we will see the openHAB2 user interface that we configured.

Do not forget to install the official openHAB mobile application on your mobile device on Android or iOS.

Mobile wallpapers!  |  Linux certification!

You can copy information from this site for personal, noncommercial use only. Copying and use of information from this site for any other purpose is prohibited.  |  All trademarks are the property of their respective owners.
© 1998-2022 Sameak. All rights reserved.