Increase number of reconnects when KNX IP Router is temporarily not accessible

Dear Community,

My setup includes OpenHAB 3.2.0 with KNX binding and a KNX IP Router acting as a bridge to OpenHAB with the following settings:

Bridge knx:ip:WHG_IP "WHG11 IP Router" [
    ipAddress="<KnxIpRouterIpAddress>",
    localIp="<OpenHabIpAddress>",
    type="TUNNEL",
    portNumber=3671,
    readingPause=50,
    responseTimeout=10,
    readRetriesLimit=3,
    autoReconnectPeriod=60,
    localSourceAddr="0.0.0" ]

In case there is an outage of the IP network for longer than about two minutes, OpenHAB stops trying to reconnect to the KNX IP Router. I understand that the autoReconnectPeriod represents the amount of seconds between connect retries when the KNX link has been lost (0 means never). I believe 60 seconds is a well chosen interval for the next retry if there is a severe issue that causes dropping the IP connection. However, I wonder where I can set the amount of retries to unlimited, as there are only a few retries. If the KNX IP Router is not accessible after a few retries, OpenHAB does not try again so that I need to restart OpenHAB once I notice that the KNX IP Router was not accessible for a while. This is really a pity as manual interaction is required abnd KNX telegrams got lost that are to be processed by InfluxDB.

I already consider solutions to avoid the IP outage as such. However, this post does not concern improvements of the availability of the IP network so that the disadvantages of the present configuration settings will not be realized. The only concern of this post is how to configure OpenHAB in a way that it may overcome instabilities from outside, i.e. unlimited retries if the KNX link is down.

Thank you very much for your hints.

Best regards,
Peter

Routing does not connect to your Knx ip router it just listens to the multicast adress 224.0.23.12 that is you leave at default. Tunneling yes does connect directly to your knx router but i would discourage that if you have a Knx router.

Hi,

Clearly, I understand the benefits of KNX IP Routing where it is possible. However, my network topology does not allow routing for all KNX IP routers. Because of different KNX IP Routers in different subnets and spread over different locations, I do not plan to cope with mDNS / Multicast relaying to overcome deficiencies that should be primarily resolved. Therefore, tunneling connections need to work even under unreliable IP conditions.

Best regards,
Peter

I think you gave your answer already-Unreliable network. Does ets left for a couple of hours in tunnel monitoring the group adresses fails the connection ? If not then post more information about your network topology without giving personal information.

Also make sure that tunnel connection that you use for openhab is different and not for other things that need a tunnel say like another home assistant or ets or gira home server etc etc.

A dirty workaround could be to have a rule trigger by the thing status going to “Offline”. If the thing goes offline disable it and re-enable it after a small pause. My expectation would be that this would restart the connection retries.

I did something similar for KLF200 interface that tends to loose connection and locks itself caused by firmware bugs - added a rule that power-cycles the device using a Z-Wave plug plus disables and re-enables the KLF200 thing. Not perfect, but working reliably.

Nevertheless your root cause that needs to be solved is the unstable network connection

1 Like

Hi Thomas,

Thank you very muh for pointing me to disabling and enabling a thing to retrigger reconnection retries… However, I am surprised that connection retries to a bridge are handled this way so that workarounds are required.

Could you give me some hints how I could achieve this? I have started with writing Jython rules and can rather follow already written code, but at present I am still lost to write a rule from scratch.

In fact, the network is not unstable. Clearly, a VPN tunnel can drop and needs to be re-established, but of course this does not cause any issues as the VPN tunnel is ready again until OpenHAB stops trying to reconnect.

An issue are planned network downtimes for a couple of minutes. While all other devices cope with the situation that a network may be temporarily down, I need to restart OpenHAB afterwards. I do not understand why the KNX binding works differently than any other IP network device.

Best regards,
Peter

This all depends on your networking skills and gear. What i did in the past was to create a site to site vpn connecting two Knx ip routers with limited group adresses exposed between them like light sensors and setpoints for heating and all off function and had openhab as visualization to control both without any issue. The networking gear was unifi in that case.

Oh and maybe count how long that it takes for your maintenance to be done and adjust the bridge autoReconnectPeriod

Here a link to a small example that shows how to enable or disable a thing based on its state.
This is for modbus but you can use it as a starting point.

Hi Thomas,

Thank you very much for your hint. The approach of disabling a thing behind the failed bridge and enabling it again does the trick, at least when I use the OpenHAB API Explorer. Unfortunately, I failed to code the sendHttpPutRequest correctly in a rule. For whatever reason sendHttpPutRequest throws an error although I used the same syntax as in the axample. I will create a separate thread for this issue as the question of this thread has been resolved.