KNX in openHab2


I like to control my KNX environment using openhab 2. Because I don’t find a way to install the “in development” KNX2 addon in my existing openHab2 instance (which would be my preferred way), I now trying to run the KNX1 binding in opneHab2.

Looking to the openHab2 documentation, the legacy-binding-part points to the openHab1-KNX-binding documentation.

But: for me it looks like the filesystem structure is different from openHab1 and openHab2. So I don’t have an idea, how to apply the KNX1-binding documentation (from openHab1 docs) on an openHab2 setup. Are there any code-examples or howto’s for merging both worlds?

By the way: for me it’s possible to install knx1 binding using the paper UI or habmin interface in openHab2. That works and the KNX1 binding comes during openHab2 startup. But, it’s not configured. So: where can I found the configuration files in openHab2 for setup an legacy binding?

Thank you.

Every configuration line that would go into openhab.cfg in OH1 like:


would go into conf/services/knx.cfg in OH2 like


Thank you for that response and those hints.
I tried that, but get the message " KNXBinding configuration is not present". Do I have to register the KNX configuration file anywhere?

I started learning, configuring and using OH2 with the knx 1.9 addon somewhere in November, so I’m not the big expert either. But the basics are working. On the raspberry pi I have a knx.cfg file in /etc/openhab2/services. It contains information about how the knx addon connects to the KNX bus. In my case I’m connecting to knxd, which in turn connects to a USB connected serial FT1.2 interface. I also have a file knx.items in /etc/openhab2/items. This one basically contains the list of KNX Group Adresses, a name and an icon to be used for it in OH2. See below for examples of both files. I didn’t have to register these files, OH2 picks them up automatically. You may need to restart OH2 if you change knx.cfg although I’m not really sure about that.

# KNX gateway IP address
# (optional, if serialPort or connection type ‘ROUTER’ is specified)

# Local KNX Binding bus address.
# Use it, when two or more openHAB Instances are connected to the same KNX bus.
# (optional, defaults to 0.0.0)

# Ignore local KNX Events, prevents internal events coming from
# 'openHAB event bus' a second time to be sent back to the 'openHAB event bus'.
# Note: To send back events second time is a Bug, but for backward compatibility, the behavior is not changed.
# For new installations, its recommend to set "ignorelocalevents=true"
# (optional, defaults to false)

# KNX IP connection type. Could be either TUNNEL or ROUTER (optional, defaults to TUNNEL)
# Note: If you cannot get the ROUTER mode working (even if it claims it is connected),
# use TUNNEL mode instead with setting both the ip of the KNX gateway and the localIp.

# KNX gateway port (optional, defaults to 3671)
# Note: If you use eibd, setting to 6720

# Local endpoint to specify the multicast interface, no port is used (optional)

# Serial port of FT1.2 KNX interface (ignored, if ip is specified)
# Valid values are e.g. COM1 for Windows and /dev/ttyS0 or /dev/ttyUSB0 for Linux

# Pause in milliseconds between two read requests on the KNX bus during
# initialization (optional, defaults to 50)

# Timeout in milliseconds to wait for a response from the KNX bus (optional,
# defaults to 10000)

# Number of read retries while initialization items from the KNX bus (optional,
# defaults to 3)

# Seconds between connect retries when KNX link has been lost
# 0 means never retry, it will only reconnect on next write or read request
# Note: without periodic retries all events will be lost up to the next read/write
#       request
# (optional, default is 0)

### Auto refresh feature
# Number of entries permissible in the item refresher queue.
# (optional, defaults to 10000)

# Number of parallel threads for refreshing items. (optional, defaults to 5)

# Seconds to wait for an orderly shutdown of the auto refresher's
# ScheduledExecutorService. (optional, defaults to 5)

# Use NAT (Network Address Translation)
#  (optional; defaults to false)


Group   LIGHT   (All)
Group   ROLLUIK (All)

Number          Lichtscene                      "Lichtscene"            <light>         (LIGHT)         { knx="5.010:1/4/1" }
Switch          Rolluik_Keuken_Alles            "Keuken"                <blinds>        (ROLLUIK)       { knx="2/3/2" }
Rollershutter   Rolluik_Bureau                  "Rolluik"               <blinds>        (ROLLUIK)       { knx="2/2/12, 2/2/11, 2/2/13" }
Switch          Licht_Alles_Uit                 "Alles uit"             <light>         (LIGHT)         { knx="1/4/0" }
Switch          Licht_Bureau                    "Licht"                 <light>         (LIGHT)         { knx="1/2/11+1/2/14" }
Dimmer          Licht_keuken                    "Keuken"                <dimmablelight> (LIGHT)         { knx="1/3/11+1/3/14, 1/3/12, 1/3/13" }
Number          Lichtsterkte_Buiten             "Lux Buiten [%.1f Lux]" <temperature>   (INFO)          { knx="9.004:3/2/21" }
Number          Temperatuur_Buiten              "°C Buiten [%.1f °C]"   <temperature>   (INFO)          { knx="9.001:3/2/20" }

@esteevens: I have used something similar to your knx.items file and it works. Items appear OpenHab2 as expected. However, it’s just the item, how about defining the Thing with the Channel to link to the item? What does your .things file look like? Because no “Things” appear in OpenHab2. Any ideas?

Hi @psiphi75,

Since the KNX Binding is coming from the 1.x world of OH, there are no “Things” & associated “Channels” available for it. The Thing+Channel concept is valid for 2.x Bindings, build for openHAB 2.

You just need to define the items (with their binding settings) and use them in your sitemap, etc.

hi esteevens
How to find knx.cfg on openhab2 ?
I did not file .cfg on openhab2.

Hi !

Have you added KNX BINDING add-on in paper-ui ?

If it’s not enough, just create a new one in services folder.