CM3-home - OpenHAB getting started

During the development and test phases of the CM3-Home, the Tanzolab Group wrote many practical articles about the different interfaces used on the board, reporting links, experiences and suggestions acknowledged meanwhile. In this article they are collected in order to achieve a "real world" tutorials archive about using CM3-Home with OpenHAB.

OpenHABian Installation

For a comprehensive tutorial about OpneHABian installation please follow the instructions on the official web site

Basic installation download on RPI and compatible boards

ATTENTION all the installation procedures are really long lasting, please be patient.

Once installed OpenHABian following the instructions, you need to proceed with customizations and add-ons installation.

Many operations are eased using the OpenHABian environment equivalent to raspi-config.

sudo openhabian-config

The CM3-Home serial ports must be prepared to be used in OpenHAB, freeing them from standard use:

  • 30 | System Setting
    • 35 | Serial Port
      • [*] 1 (RPi) Disable serial console
      • [*] 2 (RPi3) Disable Bluetooth module
      • [*] 3 Add common serial ports to openHAB JVM

use menu items according to your needs

  • 30 | System Setting
    • to change password, host name, WiFi, etc.
  • 01 | Update
  • 02 | Upgrade System
  • 20 | Install optional add-ons
    • Mosquitto
    • Grafana
    • knxd

In order to verify the configuration you can use the karaf console. Let's take the knx binding as an example.

[12:44:08] openhabian@RasPIguiott:~$ ssh -p 8101 openhab@localhost
Password authentication

                          __  _____    ____      
  ____  ____  ___  ____  / / / /   |  / __ )     
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  | 
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /      
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/     
    /_/                        2.1.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.

openhab> config:list "("
Pid:            org.openhab.knx
BundleLocation: mvn:org.openhab.binding/org.openhab.binding.knx/1.10.0
   localIp = localhost = org.openhab.knx
   type = ROUTER

In case of problems it can be useful to increase debug level to check for possible configuration errors:

openhab> log:set debug

or enable the trace

log:set TRACE org.openhab.binding.knx
log:set TRACE

It is advisable to disable them when the debug is over:

log:set DEFAULT org.openhab.binding.knx
log:set DEFAULT

All the useful information can be read in:


Or with the console command log:tail

or in the browser: http://cm3home.local:9001/

The configuration is dynamically loaded as soon as the cfg file is saved (/etc/openhab2/services/knx.cfg in the example). It could happen that the previous configurations are cached even at service restart. In that case clean up the cache before restarting the service:

openhab> config:delete org.openhab.knx

openhabian@RasPIguiott:~$ sudo systemctl restart openhab2

There are some little differences between CM3-Home and Raspberry PI 3 because of the greater hardware equipment. A comprehensive guide to all the peripherals and how to use them, can be found at CM3-Home main page

To use all of the available hardware you have to:

  • Assign the serial debug port (UART1) to GPIO32-GPIO33 instead of GPIO14-GPIO15
  • Assign the RGB LED GPIOs
  • Change the audio PWM GPIOs
  • Assign the 1-wire line
  • Assign the IR reciver port to GPIO 20
  • If needed, assign the J3 socket to SPI display
  • Set up the I2C port
  • Avoid to wait for HDMI device attached at boot (save more than 10sec at startup)

To do that, the following instructions must be added to the /boot/config.txt file:

#Serial port to GPIO 32 and 33

#CM3-Home led definition

#Enable PWM on GPIO 40 and 41 for the audio out

# Enable the 1-wire bus

#Enable the IR Linux driver

#dtoverlay=ads7846,cs=0,penirq=34,speed=10000, swapxy=0, pmax=255, xohms=60, xmin=200, xmax=3900, ymin=200, ymax=3900

#I2C on Grove socket

#Avoid waiting for HDMI device attached at boot (save more than 10sec at startup)

Take a look also at Create a Raspbian Stretch microSD article.

To assign system functions to RGB LED you must create an overlay Using this tutorial

the already prepared overlays are available:

To redirect the system console to the debug port you must edit also the file /boot/cmdline.txt adding the related instructions:

dwc_otg.lpm_enable=0 enable_uart=1 dtoverlay=pi3-disable-bt console=serial1,115200 root=PARTUUID=75a5cf8a-02 rootfstype=ext4 elevator=deadline rootwait

Integration with directly attachable hardware interfaces examples

  • KNX integration via TPUART (TP-Bus) The open source knxd service is used for this purpose. The demon has a permanent handshake with TPUART, it starts with discovery and proced with a periodic heartbeat. The KNX circuitry and TPUART itself are powered up by the external bus. In order to guarantee the correct operation, the KNX bus must be connected and powered before starting the CM3-Home.
  • Two possible utilizations for the available RS485 interfaces
  • In the case below, the opto-isolated inputs and the relays are driven through the OpenHAB GPIO binding. This binding has be written for the OpenHAB 1, the OpenHAB 2 compatibility could create some problems, please follow the official documentations
  • Execute command line operations
  • DALI (Light-bus)
  • As an example for the serial port, a simple connection with an Arduino board has been used as an example.
sudo usermod -a -G dialout openhab openhabian

Integration with services available through WiFi or LAN

Automatic configurations backup

How to setup backup procedures

Setting-up WiFi module as an Access Point

For the details follow the Andrea Montefusco presentation

After hostapd service has been installed, the automatic startup of the service must be disabled and managed through /etc/rc.local so that each service will be launched only when the device is ready. The dhcpcd service as well must be disabled. So, add the following instructions to rc.local:

# WiFi module AP mode, bridge configuration with eth0 and uap0(wlan)

echo 37 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio37/direction                                   
echo 1 > /sys/class/gpio/gpio37/value

sleep 1

ifup eth0
ifconfig eth0 up


rfkill list

ifup wlan0
ifconfig wlan0 up


brctl addbr br0
brctl addif br0 eth0

ifconfig br0 up

sleep 1

ifup br0

sleep 1

route add -net gw

iw dev wlan0 interface add uap0 type __ap
ifup uap0

hostapd /etc/hostapd/hostapd.conf &

exit 0

Add the following instructions to /etc/dhcpcd.conf configuration file if a static IP is needed:

interface eth0
static ip_address=
static routers=
static domain_name_servers=

Mobile App

To use all the CM3-Home OpenHAB features on mobile devices even when not in the same domestic network, it can be used the open cloud service offered by OpenHAB and the corresponding app available for both iOS and Android

After installing the openHAB Cloud Connector

the following files will be available:


The files content is needed to setup the cloud service. A complete tutorial about installation and configuration is available on Youtube.

The same functions available on local UI can be used also on mobile device once connected with the cloud service.


How to use an external, dedicated panel display to interact with CM3-Home through HABpanel UI.


how to launch the HABpanel at startup.

In the display user home directory configuration file:



chromium-browser --kiosk

with the CM3-Home IP address.

To disable screen saver and cursor in the browser, in file


un-comment the Xserver line es add the needed parameters:

xserver-command=X -s 0 -dpms -nocursor

To disable the low battery icon

add the instruction avoid_warnings=1 at /boot/config.txt

Guido Ottaviani (Author/Designer/Developer for electronics-firmware-robotics)
He deals with electronic design and embedded system firmware for Robotics and industrial and civil applications, as well as technical disclosure on the internet. - -