KNX2 stopps working after a while (received disconnect response status 0x21)

I don’t use knxd so I can’t help much :frowning:
the tcp6 entry looks ok. it listens to both v4 & v6.

your ethernet interface has the M flag (for multicast), so that’s ok also…
not sure what could be wrong. play with different knxd settings maybe?

most use tcp port 3671 (applies to both tunneling and routing)

KNXD uses 6720 per default. Strange thing.
I switched back to using the IP Interface from MDT. Although i have a similar problem there since i switched to the knx2 binding of OH. It also stops working but with a different error.
Worked with the knx1 binding before without problems :frowning:
Will update here with the new error.

Similar problem when using the Remote MDT interface.

2018-06-27 22:04:43.675 [DEBUG] [nx.internal.client.AbstractKNXClient] - Bridge knx:ip:bridge is disconnecting from the KNX bus
2018-06-27 22:04:43.688 [DEBUG] [nx.internal.client.AbstractKNXClient] - The KNX network link was detached from the process communicator
2018-06-27 22:04:43.706 [DEBUG] [nx.internal.client.AbstractKNXClient] - Bridge knx:ip:bridge is connecting to the KNX bus
2018-06-27 22:04:43.715 [DEBUG] [binding.knx.internal.client.IPClient] - Establishing connection to KNX bus on 192.168.188.29:3671 in mode TUNNEL.
2018-06-27 22:04:43.746 [ERROR] [net/IP Tunneling 192.168.188.29:3671] - establishing connection failed, null
2018-06-27 22:04:43.760 [DEBUG] [nx.internal.client.AbstractKNXClient] - Error connecting to the bus: null
java.lang.InterruptedException: null
        at java.lang.Object.wait(Native Method) ~[?:?]
        at tuwien.auto.calimero.knxnetip.ConnectionBase.waitForStateChange(ConnectionBase.java:541) ~[?:?]
        at tuwien.auto.calimero.knxnetip.ClientConnection.connect(ClientConnection.java:190) ~[?:?]
        at tuwien.auto.calimero.knxnetip.KNXnetIPTunnel.<init>(KNXnetIPTunnel.java:159) ~[?:?]
        at org.openhab.binding.knx.internal.client.IPClient.getConnection(IPClient.java:107) ~[?:?]
        at org.openhab.binding.knx.internal.client.IPClient.createKNXNetworkLinkIP(IPClient.java:90) ~[?:?]
        at org.openhab.binding.knx.internal.client.IPClient.establishConnection(IPClient.java:77) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.connect(AbstractKNXClient.java:178) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.connectIfNotAutomatic(AbstractKNXClient.java:164) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.readNextQueuedDatapoint(AbstractKNXClient.java:272) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.lambda$1(AbstractKNXClient.java:199) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
2018-06-27 22:04:43.991 [DEBUG] [nx.internal.client.AbstractKNXClient] - Bridge knx:ip:bridge is disconnecting from the KNX bus

any ideas @Dim ?
Thanks.

config is this now:

Bridge knx:ip:bridge [
        ipAddress="192.168.188.29",
        portNumber=3671,
        localIP="192.168.188.28",
        type="TUNNEL",
        readingPause=50,
        responseTimeout=10,
        readRetriesLimit=3,
        autoReconnectPeriod=1
] 

Stopping and restarting the KNX bundle solves the problem. For some hours at least.
The old knx1 binding worked with this hardware and gateway setup without problems.

I don’t know what could be wrong…configs look good

It could be a bug with the binding, it could be a comms issue…

Double check networking stuff between the OH2 host and the MDT interface (swap UTP cables, Ports on the Switch, ethernet card on the host, go direct for testing if possible). What hardware are you running OH2 on? (rPi or something else?).
Can you test the KNX2 binding connectivity on another host running OH2 ?

Try to enable TRACE on the tuwien.auto.calimero also to see if anything interesting comes up.

Hardware is the same as with OH2 and knx1 (beaglebone connected to GBIT Switch).
With knx1 it just worked.

2018-06-29 21:02:29.078 [DEBUG] [nx.internal.client.AbstractKNXClient] - The KNX network link was detached from the process communicator
2018-06-29 21:02:29.081 [DEBUG] [nx.internal.client.AbstractKNXClient] - Bridge knx:ip:MDT is disconnecting from the KNX bus
2018-06-29 21:02:29.095 [DEBUG] [nx.internal.client.AbstractKNXClient] - Bridge knx:ip:MDT is connecting to the KNX bus
2018-06-29 21:02:29.292 [DEBUG] [binding.knx.internal.client.IPClient] - Establishing connection to KNX bus on 192.168.188.29:3671 in mode TU
NNEL.
2018-06-29 21:02:29.085 [DEBUG] [.knx.handler.AbstractKNXThingHandler] - An error occurred while testing the reachability of a thing 'knx:dev
ice:MDT:ug_sa1'
tuwien.auto.calimero.link.KNXLinkClosedException: link closed
        at tuwien.auto.calimero.link.AbstractLink.send(AbstractLink.java:348) ~[?:?]
        at tuwien.auto.calimero.link.KNXNetworkLinkIP.sendRequestWait(KNXNetworkLinkIP.java:222) ~[?:?]
        at tuwien.auto.calimero.mgmt.TransportLayerImpl.sendData(TransportLayerImpl.java:372) ~[?:?]
        at tuwien.auto.calimero.mgmt.ManagementClientImpl.send(ManagementClientImpl.java:797) ~[?:?]
        at tuwien.auto.calimero.mgmt.ManagementClientImpl.sendWait2(ManagementClientImpl.java:824) ~[?:?]
        at tuwien.auto.calimero.mgmt.ManagementClientImpl.readDeviceDesc(ManagementClientImpl.java:447) ~[?:?]
        at tuwien.auto.calimero.mgmt.ManagementProceduresImpl.isAddressOccupied(ManagementProceduresImpl.java:310) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.isReachable(AbstractKNXClient.java:338) ~[?:?]
        at org.openhab.binding.knx.handler.AbstractKNXThingHandler.pollDeviceStatus(AbstractKNXThingHandler.java:144) ~[?:?]
        at org.openhab.binding.knx.handler.AbstractKNXThingHandler.lambda$1(AbstractKNXThingHandler.java:184) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
2018-06-29 21:02:29.334 [ERROR] [net/IP Tunneling 192.168.188.29:3671] - establishing connection failed, null
2018-06-29 21:02:29.345 [DEBUG] [nx.internal.client.AbstractKNXClient] - Error connecting to the bus: null
java.lang.InterruptedException: null
        at java.lang.Object.wait(Native Method) ~[?:?]
        at tuwien.auto.calimero.knxnetip.ConnectionBase.waitForStateChange(ConnectionBase.java:541) ~[?:?]
        at tuwien.auto.calimero.knxnetip.ClientConnection.connect(ClientConnection.java:190) ~[?:?]
        at tuwien.auto.calimero.knxnetip.KNXnetIPTunnel.<init>(KNXnetIPTunnel.java:159) ~[?:?]
        at org.openhab.binding.knx.internal.client.IPClient.getConnection(IPClient.java:107) ~[?:?]
        at org.openhab.binding.knx.internal.client.IPClient.createKNXNetworkLinkIP(IPClient.java:90) ~[?:?]
        at org.openhab.binding.knx.internal.client.IPClient.establishConnection(IPClient.java:77) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.connect(AbstractKNXClient.java:178) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.connectIfNotAutomatic(AbstractKNXClient.java:164) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.readNextQueuedDatapoint(AbstractKNXClient.java:272) ~[?:?]
        at org.openhab.binding.knx.internal.client.AbstractKNXClient.lambda$1(AbstractKNXClient.java:199) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
2018-06-29 21:02:29.579 [DEBUG] [nx.internal.client.AbstractKNXClient] - Bridge knx:ip:MDT is disconnecting from the KNX bus

:

enabled debug - not really helpful - right?
considering to migrate back to KNX1 binding now :frowning:

Completely purged my openhab2 installation, wiped all configs, etc.
reinstalled a fresh 2.3 - now everything seems to be fine with using the knx2 binding
No KNX disconnect any more for 4 days now.

i hope that’s it!

1 Like

I have the same problem. Starting openHab everything works fine but after a few hours it seems to disconnect.

The reinstall thing sounds interesting. Is everything still working for you now?
Hm, maybe I start deleting caches ant temp files first…

Jep, everything still working. I completely wiped everything, in my old installation i had some config files from knx1 binding left - thought that would be no problem cause the binding was inactive.

1 Like

Thanks, also reinstalled openhab and it seems to work fine. No problems for 24h, never had that since using the knx2 binding.

Would be really interesting what causes the problem. I uninstalled the old knx binding, cleared the cache,… but it didn’t help. Uninstall and a fresh openhab2 install and it seems to work fine.

1 Like

Wanted to add some information. The clean openh2 installation worked fine, so no more disconnects from knx.

However, after about 3 weeks I found out that querying of my Kostal Pico inverter does not work anymore because I forgot to reinstall the HTTP binding. After reinstalling it it seems the problem reoccurred. The next day openhab disconnected again. I removed the HTTP binding and everything works fine.

I have to do another check, might have been a coincidence, but maybe there is some side effect between those bindings…

I have several fresh OH 2.3 installations and have the same problem. For some of them problem appeared after few months of work and for others after few days.
For now I have workaround - rule that restarts bundle when knx ip bridge thing changed status to UNINITIALIZED. Since KNX binding is the most important to me I’m interested in the final solution.

Are you using file thing configuration or PaperUI?

I am using file configurations for nearly everything. So the things as well as all my items.

@ andrzej_szymkowicz could you paste the rule you are using to restart the bundle?

Rule is simple:
rule “KNXThingRestart”
when
Thing “knx:ip:bridge” changed to UNINITIALIZED
then
systemKNXBundleRestart.sendCommand(ON)
end

but first you need to configure auto login to karat console by openhab user and create command thing and item:

  1. Karaf console autologin:
    mkdir /var/lib/openhab2/.ssh
    cd /var/lib/openhab2
    sudo chown -R openhab:openhab .ssh
    cd /var/lib/openhab2/.ssh
    sudo -u openhab ssh-keygen -t rsa -f openhab.id_rsa
    sudo chmod 400 openhab.id_rsa
    sudo -u openhab nano config
    Host console
    hostname localhost
    port 8101
    user openhab
    IdentityFile /var/lib/openhab2/.ssh/openhab.id_rsa

sudo chmod 400 config

Import the public key (sudo -u openhab cat openhab.id_rsa.pub) into /var/lib/openhab2/etc/keys.properties like
openhab=AAAAB3NzaC1kc3M…XWKpeyW789IBpcZfyYQ=,g:admingroup
Be aware that the leading “ssh-key” and trailing “user@server” has to be omitted.

sudo -u openhab ssh console

  1. Command Thing
    Name: KNX Bundle Restart
    ThingID: KNXBundleRestart
    Command: ssh console bundle:restart org.openhab.binding.knx
    Interval: 0

  2. Item:
    Switch systemKNXBundleRestart “KNX bundle” { channel=“exec:command:KNXBundleRestart:run”}

1 Like

Thanks a lot!

Hello all,
I have just set up a fresh openhabian install and now I encounter the same problems. On my bus system I do have a GIRA X1 (which can act as an KNX/IP Gateway) and also a GIRA KNX-IP GW.
I do not have a knxd running because it was my understanding that this is only an intermediate service between the bus and the openhab2 instance which is not needed.
This set up has been working on openhab pre 2.4 flawlessly.

Are there any new thoughts regarding the root cause of this problem?

My situation is exactly as desribed here: knx works fine for about 2 hours, then it disconnects and cannot reconnect.

Below is my knx.things [only the connection part]

Any thoughts?
Best,
Hanns-Joerg

Bridge	knx:ip:GIRAKNXIP "GIRA X1 " @ "KNX" [
	type="TUNNEL",
	ipAddress="192.168.0.4", //war .93 für KNX-IP-GW
	portNumber=3671,
	localIp="192.168.0.11",
	readingPause=50,
	responseTimeout=10,
	readRetriesLimit=3,
	autoReconnectPeriod=1,
	localSourceAddr="0.0.2" ]
	{
                Thing device KNXDUMMY "KNXDEVICE" @ "KNX" [ fetch=false, pingInterval=600, readInterval=0 ]
                { ..... }

Hello
Same issue on my Raspi. I’m using MDT’s «SCN-IP000.02 IP Interface».
It works like i charm but only for a few hours, then the KNX is disconnected.
All other bindings are not affected, only the KNX Binding (binding-knx - 2.4.0).
I have absolute no clue what to change in my config. (see some excerpts and netstat below)
Is there anyone who solved the issue?
Thanks to all in advance who provide any hints or solution…

BR, urs

openHABianPi

Ip = 192.168.10.23
Release = Raspbian GNU/Linux 9 (stretch)
Kernel = Linux 4.14.79+
Platform = Raspberry Pi Model B Rev 2
Updates = 0 apt updates available.

knx.things

Bridge knx:ip:bridge [
ipAddress=“192.168.10.11”,
portNumber=3671,
localIp=“192.168.10.23”,
type=“TUNNEL”,
readingPause=50,
responseTimeout=10,
readRetriesLimit=3,
autoReconnectPeriod=1,
localSourceAddr="0.0.0*
] {
Thing device generic [
address=“1.1.209”,
fetch=true,
pingInterval=300,
readInterval=3600
]
{
Type switch : Licht_Aussen_Terasse “Terrasse” [ ga=“1/1/137” ]
Type switch : Licht_Aussen_Eingang “Eingang & Garage” [ ga=“1/1/144” ]
}
}

netstat -i

Kernel-Schnittstellentabelle
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 308838 0 265 0 194660 0 0 0 BMRU
lo 65536 837 0 0 0 837 0 0 0 LRU

All:

not a solution yet. But I installed knxd on the raspi running openhabian. I have set up knxd so that I can connect to the bus manually (knxtool commandline). However, I did not change my thing definition. This means, I do not use knxd for openhabian, but I have a constantly working connection right now.

Best,
Hajoka

@hajoka could you please share the config of your knxd?
Thanks

Dear,
I’ve the same problem. Are there news about it?
I’m try to restart knx binding as write from andrzej_szymkowicz but I’m using sendCommand without good results because I receive a message where OH say to me problems with accessing permission of rsa file. I’m using openhabian and I don’t understand because there the openhab and the openhabian users. I think I need to use openhab user but I don’t fine its password on intenet.

Can you help me? My porting work for upgrate to KNX2 from KNX1 is not usable if KNX2 stop working.

Thanks

I solved it by programming a service restart every time it goes offline.

I got the result by creating in my raspberry openhabian installation this sh file (install sshpass before with: apt-get install sshpass):

// restartknx.sh
sudo -u [YOUR_SYSTEM_USER] sshpass -p [YOUR_SYSTEM_PASSWORD] ssh openhab@localhost -p 8101 'bundle:restart org.openhab.binding.knx'

and running it by this cron rule:

rule "Restart KNX"

when
        
	Time cron "0/10 * * ? * *" 

then
  
	val allThings = sendHttpGetRequest("http://192.168.1.81:8080/rest/things")

	  if(allThings.indexOf('BRIDGE_OFFLINE"},"editable":false,"label":"KNK [ATT] 1.1.4')>0){
	
    logInfo("KNX", "KNX Autorestart")
    
	    var String esito = executeCommandLine("/etc/openhab2/scripts/restartknx.sh",5000)

	    if(esito!=''){
      
	        logInfo("KNX", "Autorestart completed (" + esito +")")
    
	    }
	
  }

end

In the sh file I check offline thing status searching “BRIDGE_OFFLINE”},“editable”:false,“label”:“KNK [ATT] 1.1.4” string into json sendHttpGetRequest result. This is a specific string of a my knx thing and you must search a your specific different string.

Remember to change [YOUR_SYSTEM_USER] and [YOUR_SYSTEM_PASSWORD] with your openhabian credentials of a my knx thing and you can search a your specific different string.