KNX Binding Configuration Changes cause Exception

Hi All,

During my recent adventure with the KNX Binding, I found the following:

With config:OpenHab 2.0.0-SNAPSHOT (Build #533) on Raspberry Pi 3 using KNX Binding 1.9.0.SNAPSHOT (1.9.0.201610130111)

Problem Description:
When the KNX configuration is changed from TUNNEL to ROUTER type in /etc/openhab2/services/knx.cfg and the OpenHab service is restarted, an error is generated: “non-valid routing multicast”

How to replicate:
0) (optional) Enable at least ERROR log output level on the org.apache.felix.configadmin: log:set ERROR org.apache.felix.configadmin (from the karaf console while OH2 is running with ssh openhab@localhost -p 8101 with password habopen)

  1. Stop OpenHab 2 service (/etc/init.d/openhab2 stop)

  2. Configure /etc/openhab2/services/knx.cfg with the following settings:

ip=<ip_address_of_KNX_gateway> (example: 172.16.13.200)
type=TUNNEL (optional, defaults to TUNNEL)
port=3671 (optional, defaults to 3671)
localIp=<ip_address_of_local endpoint> (example: 172.16.13.101)
  1. Start OpenHab 2 service (/etc/init.d/openhab2 start) and let it load up (give it 1 min)
  2. Stop OpenHab 2 service (/etc/init.d/openhab2 stop)
  3. Change the configuration of /etc/openhab2/services/knx.cfg with the following settings (only that):
type=ROUTER
  1. Start OpenHab 2 service (/etc/init.d/openhab2 start)
  2. Observe /var/log/openhab2/openhab2.log (or log:display |grep knx) for entry with info “non-valid routing multicast”
2016-10-14 13:46:11.612 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, id=302, bundle=194/mvn:org.openhab.binding/org.openhab.binding.knx/1.9.0-SNAPSHOT]: Unexpected problem updating configuration org.openhab.knx
tuwien.auto.calimero.exception.KNXIllegalArgumentException: non-valid routing multicast /172.16.13.200
	at tuwien.auto.calimero.knxnetip.KNXnetIPRouting.<init>(KNXnetIPRouting.java:121)[194:org.openhab.binding.knx:1.9.0.201610130111]
	at tuwien.auto.calimero.knxnetip.KNXnetIPRouting.<init>(KNXnetIPRouting.java:104)[194:org.openhab.binding.knx:1.9.0.201610130111]
	at tuwien.auto.calimero.link.KNXNetworkLinkIP.<init>(KNXNetworkLinkIP.java:192)[194:org.openhab.binding.knx:1.9.0.201610130111]
	at org.openhab.binding.knx.internal.connection.KNXConnection.connectByIp(KNXConnection.java:292)[194:org.openhab.binding.knx:1.9.0.201610130111]
	at org.openhab.binding.knx.internal.connection.KNXConnection.connect(KNXConnection.java:179)[194:org.openhab.binding.knx:1.9.0.201610130111]
	at org.openhab.binding.knx.internal.connection.KNXConnection.updated(KNXConnection.java:448)[194:org.openhab.binding.knx:1.9.0.201610130111]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1444)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1400)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)[7:org.apache.felix.configadmin:1.8.8]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]

Root-cause:
The configuration of the KNX Binding in Karaf retains the ip setting from the tunneling setup and tries to use it when re-configuration is done in Router mode.

Workarounds:

  1. Remember to set ip=224.0.23.12 (the default multicast IP Address for KNXnet/IP) when using type=ROUTER in order to overwrite the already stored ip setting (if changing from a previous Tunnel configuration)
    or
  2. Remove the already stored ip setting from the karaf console with:
config:edit org.openhab.knx
config:property-delete ip

or remove all settings from the existing, already stored KNX Binding config with config:delete org.openhab.knx in Karaf console and restart OpenHab 2 to reload from scratch the /etc/openhab2/services/knx.cfg file

Maybe, upon startup, the OpenHab 2 service should clear out the existing org.openhab.knx config stored in the system and load clean the knx.cfg file to avoid this kind of problems?

BR,
Angelos

By the way, the Wiki entry in GitHub on the KNX Binding (Revision #b726642) contains an error with regards to the post above.

The sample configuration provided here:

A sample configuration could look like:

knx:ip=192.168.1.10
knx:type=ROUTER

In theory will cause an error/exception (non-valid routing multicast) since when you use type ROUTER, you either don’t set the gateway IP or you use the default multicast ip (224.0.23.12)

Also, I believe that this example is also wrong in the documentation (same wiki article, few paragraphs below):

For alternative multicast IP adress for example, add in both KNX configurations:

knx:localIp=239.0.0.1
knx:ip=239.0.0.1

The multicast ip should be set only in the knx:ip setting only (not the knx:localIp also).
The knx:localIp should be used to define the local ip (optionally) in case of ROUTER config.

BR,
Dim
Ps: I edited the Wiki page to update the content (Revision #1ca08f6) … It seems that my change was already implemented… I thought that I couldn’t modify the content without some kind of approval :slight_smile:

I’m getting exact the same error/exception (non-valid routing multicast), but never changed from TUNEL to ROUTER. I can’t get a connection at all. So what can I do?

ifconfig file from my Enertex KNX/IP-Router

IP…: 192.168.178.17
Subnet mask…: 255.255.255.0
Gateway…: 192.168.178.1
NTP server…: 192.168.178.1
Sys multicast.: 224.0.23.12
RT multicast…: 224.0.23.12

knx.cfg

ip=192.168.178.17
busaddr=1.1.12
type=ROUTER
localIp=224.0.23.12 (is this correct, since the real ip address of my openHAB server 192.168.178.35 ?)

set

ip=224.0.23.12

and

localIp=192.168.178.35

also, add

ignorelocalevents=true

Many thanks for your fast response! It’s working now :sunny:
Why the hell is the description of ‘ip’ parameter telling “# KNX gateway IP address” ?
It’s WRONG! This is a “# Multicast IP address of the KNX gateway” Someone should change it.

Thanks again! You’ve made my day!

1 Like