Unable to connect with knx on RPi

Hey there,

I am new to OpenHAB and tried it on my windows desktop PC. I like it and everything is working as expected so i bought a RPi 3 to run the OpenHAB server. Now i installed version 1.8.1 on my Pi and copied the configuration etc. to the configuration directory. When i start the server is get an invalid argument exception when opening the connection to KNX

Output from OpenHAB.log:

2016-03-18 08:51:20.929 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.8.1).
2016-03-18 08:51:23.617 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started
2016-03-18 08:51:23.750 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.
2016-03-18 08:51:28.802 [INFO ] [penhab.io.rest.RESTApplication] - Started REST API at /rest
2016-03-18 08:51:32.657 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'test.sitemap'
2016-03-18 08:51:33.364 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'thuis.sitemap'
2016-03-18 08:51:33.503 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'test.script'
2016-03-18 08:51:33.737 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'knx.items'
2016-03-18 08:51:34.226 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /classicui/openhab.app
2016-03-18 08:51:39.038 [WARN ] [.p.m.i.MysqlPersistenceService] - The SQL database URL is missing - please configure the sql:url parameter in openhab.cfg
2016-03-18 08:51:39.307 [ERROR] [b.k.i.connection.KNXConnection] - Error connecting to KNX bus: on connect to /10.0.0.120:3671: Invalid argument
2016-03-18 08:51:39.310 [WARN ] [b.k.i.connection.KNXConnection] - Inital connection to KNX bus failed!
2016-03-18 08:51:39.311 [INFO ] [b.k.i.connection.KNXConnection] - KNX link will be retried in 30 seconds
2016-03-18 08:51:39.324 [ERROR] [tuwien.auto.calimero          ] - [ManagedService Update Queue] KNXnet/IP Tunneling 10.0.0.120:3671: communication failure on connect
java.io.IOException: Invalid argument
        at java.net.PlainDatagramSocketImpl.send(Native Method) ~[na:1.8.0_65]
        at java.net.DatagramSocket.send(DatagramSocket.java:693) ~[na:1.8.0_65]
        at tuwien.auto.calimero.knxnetip.ClientConnection.connect(ClientConnection.java:143) ~[na:na]
        at tuwien.auto.calimero.knxnetip.KNXnetIPTunnel.<init>(KNXnetIPTunnel.java:117) ~[na:na]
        at tuwien.auto.calimero.link.KNXNetworkLinkIP.<init>(KNXNetworkLinkIP.java:180) ~[na:na]
        at org.openhab.binding.knx.internal.connection.KNXConnection.connectByIp(KNXConnection.java:263) ~[na:na]
        at org.openhab.binding.knx.internal.connection.KNXConnection.connect(KNXConnection.java:159) ~[na:na]
        at org.openhab.binding.knx.internal.connection.KNXConnection.updated(KNXConnection.java:409) ~[na:na]
        at org.eclipse.equinox.internal.cm.ManagedServiceTracker$1.run(ManagedServiceTracker.java:183) ~[na:na]
        at org.eclipse.equinox.internal.cm.SerializedTaskQueue$1.run(SerializedTaskQueue.java:36) ~[na:na]
2016-03-18 08:51:39.326 [WARN ] [tuwien.auto.calimero          ] - [ManagedService Update Queue] KNXnet/IP Tunneling 10.0.0.120:3671: try to specify the actual IP address of the local host

My knx config:

################################ KNX Binding ##########################################
#
# KNX gateway IP address
# (optional, if serialPort or connection type 'ROUTER' is specified)
knx:ip=10.0.0.120

# 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)
#knx:busaddr=

# 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 "knx:ignorelocalevents=true"
# (optional, defaults to false)
#knx:ignorelocalevents=

# 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:type=

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

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

# 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
#knx:serialPort=

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

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

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

# 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)
knx:autoReconnectPeriod=30

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

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

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

I don’t know what to do here. On my windows pc i use the same version and the same config and there it works fine.

Please try to set the knx:localIp (this is the ip of openHAB respectively the RPi3 itself)
I had the same error, seems to be an issue when determining the local IP (maybe insufficient permissions for openHAB-user under Linux, I never investigeated…)

1 Like

Thanks Udo, this solved my problem. I can imagine that it has some problem with DHCP addressing. Maybe i will find the issue one day but for now it works. :slight_smile: