Homematic reconnect fails with Address already in use


after some time openHab loses the connection to homegear. This seems to happen because the binding tries to restart the BIN-RPC server. When it does this, the shutdown seems to be not fully complete and the port is not freed when the server is started again:

2017-05-31 15:28:57.925 [DEBUG] [nal.communicator.server.BinRpcServer] - Stopping BIN-RPC server
2017-05-31 15:28:57.927 [DEBUG] [nal.communicator.server.BinRpcServer] - Initializing BIN-RPC server at port 9126
2017-05-31 15:28:57.930 [DEBUG] [ommunicator.AbstractHomematicGateway] - Address already in use (Bind failed)
java.net.BindException: Address already in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method)[:1.8.0_131]
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)[:1.8.0_131]
at java.net.ServerSocket.bind(ServerSocket.java:375)[:1.8.0_131]
at java.net.ServerSocket.bind(ServerSocket.java:329)[:1.8.0_131]
at org.openhab.binding.homematic.internal.communicator.server.BinRpcNetworkService.(BinRpcNetworkService.java:46)[195:org.openhab.binding.homematic:]
at org.openhab.binding.homematic.internal.communicator.server.BinRpcServer.start(BinRpcServer.java:42)[195:org.openhab.binding.homematic:]
at org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.startServers(AbstractHomematicGateway.java:228)[195:org.openhab.binding.homematic:]
at org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.access$4(AbstractHomematicGateway.java:222)[195:org.openhab.binding.homematic:]
at org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway$ReconnectThread.run(AbstractHomematicGateway.java:903)[195:org.openhab.binding.homematic:]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_131]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_131]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_131]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_131]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]

When I check the ports with netstat afterwards, port 9126 is not in use. Raising aliveInterval makes things better as the server is not restarted so often, but the problem persists.

Does anybody else see these problems (and has an idea on how to fix this)?


Just happened again.

Nobody else has this? I am wondering what is different in my setup.


I’m on OH 2.1 and homegear 0.6.20-987.

After a few hours (ca. 14h) the Binding shows this behaviour also to me:
2017-07-06 10:21:26.654 [INFO ] [ommunicator.AbstractHomematicGateway] - No event since 43190 seconds from gateway ‘9cdbbaf1’, restarting RPC server
2017-07-06 10:21:26.659 [WARN ] [ommunicator.AbstractHomematicGateway] - Address already in use (Bind failed)

I’ll try updating homegear today and report

EDIT: Update went fine to version 0.7.5-1247. Will report back when issue continues

I have reported the issue: https://github.com/openhab/openhab2-addons/issues/2352

got a similar problem with the homematic-binding and a raspberrymatic-ccu. It looses connection due a bad bandwith between openhab2 and the ccu, then failes to reconnect due the bind-failure.:

Hi - I’m affected by this too.

There seems to be a fix committed any hints how to just install the patched binding into a 2.1 stable installation?

There is no fix committed as far as I know. But the binding implementation has changed in so far that there is no longer a cyclic reconnect, but the connection is monitored and a reconnect is triggered only when the connection is gone. I never see reconnects at all on my system.

As for installing the updated version, I would assume you can download the 2.2 version of the binding from here:

Then deinstall your version and drop the jar into /usr/share/openhab2/addons.


switching to Snapshot did not really work, anyways I did re-set this up again from scratch and now the issues seem to have disappeared. Might be related to training, linking via the CCU and refreshing items while doing so.

Wanted to try the linked binding

Restarted Openhab and tried to create the bridge, now this came up:

2017-11-04 19:04:52.262 [WARN ] [ore.thing.internal.ThingRegistryImpl] - Cannot create thing. No binding found that supports creating a thing of type homematic:bridge.

Is it only working on the latest snapshot? I am running the stable 2.1 openhabian

I have no idea if this works with 2.1 stable. Have you checked the log for errors? Have you checked that the binding is loaded in the console?

Binding is displayed in PaperUI under configuration -> bindings

No errors in log, first log is

2017-11-04 19:04:52.262 [WARN ] [ore.thing.internal.ThingRegistryImpl] - Cannot create thing. No binding found that supports creating a thing of type homematic:bridge

after trying to create the bridge

Did you try to create the bridge with the UI? If this does not work then maybe something changed in openhab that broke the compatibility from 2.1 to 2.2.

Tried to create it in the UI, then this failure comes up.

Tried to create a things file, nothing happens

Same for me,

the 2.2 snapshot is loaded and active, but creating the bridge fails.

Reverted back to 2.1 after deleting all Things, not further issues since then.

Still no solution?
Homematic binding is absolutely unusable for me :frowning:

Which OH version are you using? I am not sure whether this snapshot version of the binding will run on OH 2.1.

i use the openhabian version, i think its 2.1 stable

Did you try the OpenHAB 2.2 with the 2.2 Binding?

If not, please do so. I did not run OpenHAB 2.1 / Homematic 2.2 Binding, but running the 2.2 Binding with a 2.2 OpenHAB works. And running the 2.1 Binding with openHAB 2.1 worked as well.

I would read that error message as the Bridge object has been changed between 2.1 and 2.2 and the 2.2 Binding is unable to provide a Bridge object of the exact class the 2.1 OpenHAB is expecting. But i may be wrong.

The failure and Logs i posted here

Comes up with OpenHAB 2.1 and the 2.1 Binding i installed in paperUI.

After that i hoped the 2.2 Binding would bring a change and tried it.

Tomorrow i will try the latest snapshot with the 2.2 binding

I updated to OH 2.2 and installed the 2.2 homematic binding. Presently it seems to be working.

Taking a wait and seeing approach.

Thx for help so far