Homematic CCU2 connection/timeout issues

516 views
Skip to first unread message

thorsten...@gmail.com

unread,
Dec 5, 2013, 4:37:26 AM12/5/13
to ope...@googlegroups.com
Hello,

I'm trying to get openHAB-1.4-SNAPSHOT (needed because of device support) running with a Homematic CCU2. It works well for about two hours but stops receiving updates from the CCU2 via XML-RPC at some point in time.

My openhab.log shows ten exceptions of this type:

19:15:34.577 ERROR o.a.x.server.XmlRpcErrorLogger[:36]- Failed to read XML-RPC request: Read timed out
org.apache.xmlrpc.XmlRpcException: Failed to read XML-RPC request: Read timed out
    at org.apache.xmlrpc.server.XmlRpcStreamServer.getRequest(XmlRpcStreamServer.java:73)
    at org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:199)
    at org.apache.xmlrpc.webserver.Connection.run(Connection.java:208)
    at org.apache.xmlrpc.util.ThreadPool$Poolable$1.run(ThreadPool.java:68)
Caused by: java.net.SocketTimeoutException: Read timed out

The CCU's log contains the corresponding lines:

Dec  4 19:15:34 homematic-ccu2 user.err rfd: XmlRpcClient error calling event({[methodName:"event",params:{"8243689","KEQ0509765:4","CONTROL_MODE",0}],[methodName:"event",params:{"8243689","KEQ0509765:4","FAULT_REPORTING",0}],[methodName:"event",params:{"8243689","KEQ0509765
Dec  4 19:15:34 homematic-ccu2 user.err rfd: XmlRpc fault: [faultCode:0,faultString:"Failed to read XML-RPC request: Read timed out"]
Dec  4 19:16:12 homematic-ccu2 user.err rfd: XmlRpcClient error calling event({[methodName:"event",params:{"8243689","KEQ0518961:4","CONTROL_MODE",0}],[methodName:"event",params:{"8243689","KEQ0518961:4","FAULT_REPORTING",0}],[methodName:"event",params:{"8243689","KEQ0518961
Dec  4 19:16:12 homematic-ccu2 user.err rfd: XmlRpc transport error

One information I got from a post in a Homematic forum says that the CCU2 kicks a client from its internal list after 10 failed requests. This matches to the number of exceptions in my logfiles.

I don not really know what is causing the read timeouts. Maybe my Raspberry Pi is too slow to react on the request sometimes. But I think we need some facility to try to reconnect to the CCU after getting the XmlRpcExceptions. What do you think?

Regards,
Thorsten
openhab.log
ccu2_messages.log

Thomas Letsch

unread,
Dec 5, 2013, 2:59:56 PM12/5/13
to ope...@googlegroups.com
Hi Thorsten,

thanks for the report. I am already working on a solution for the broken connection.
First thought is to refresh the connection every x minutes. I don't want to do it, because I think this is and expensive operation, but it could come to that.
For now I test a version where I check every 15min if the connection is still alive and refresh it if not.

The read timeout is indeed a strange think. Thats also something i will investigate further...

R:,
Thomas

Thorsten Gilfert

unread,
Dec 6, 2013, 3:07:47 AM12/6/13
to ope...@googlegroups.com
Hello Thomas,

my idea was to extend the XmlRpcStreamServer to support a "listener" for XmlRpcExceptions. This would allow the binding to register as a listener and to reconnect only on errors. I did some prototyping yesterday but since it takes about two hours to reproduce the read timeout I have no test results yet.

Regards,
Thorsten

Thomas Letsch

unread,
Dec 7, 2013, 7:11:30 AM12/7/13
to ope...@googlegroups.com, roger...@telia.com
Hi all,

did some more tests and fixes during the last days. 
My test during last night was perfectly ok, although I was using a normal server (PC comparable power), not a RasPie.
Anyway I did some more strenghning of the binding:
- The binding checks now every 15min if the connection to the CCU2 is still working. If not, it will re-init it.
- The socket timeout is now 30sec (was 4sec). Lets see if that fixes your problem.

The version is available in my clone (https://github.com/thomasletsch/openhab/tree/workspace - the url has changed a little bit)  

Perhaps you could test that and tell me if this works better.
@Roger:
Do you run OH also on a RasPie?

 R.,
Thomas

Falk Sauer

unread,
Dec 8, 2013, 3:27:59 AM12/8/13
to Unname

Hi Thomas,

pls. think on state's of push button switches, if you update all states by an reconnect you get a false state from ccu and all rules where triggered. Here helps only a internal switch variable to detect the reconnect and inhibit this rules for a little time. The same problem as on startup.

Regards
  Falk

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/groups/opt_out.

Thorsten Gilfert

unread,
Dec 9, 2013, 4:33:06 AM12/9/13
to ope...@googlegroups.com, roger...@telia.com
Hello Thomas,

I tried your fix and run into two issues:

1. Calling removeCallbackHandler() followed by registerCallbackHandler() results in BindExceptions on my installation. I don't know why yet. But what I found out is that simply calling

ccu.getConnection().init("", "" + ccu.getConnection().hashCode()); 

followed by

ccu.getConnection().init("http://" + callbackHost + ":" + callbackPort + "/xmlrpc", "" + ccu.getConnection().hashCode());

solves the initial disconnection issue too. I don't know whether this has any drawbacks.

2. Your
ccu.getConnection().isAlife()did not discover the disconnection in my tests. The call returns true even if the CCU2 has stopped sending events to our callback XmlRpcServer. So I tried the following: store the timestamp of each call to the CCURF.event() method
and compare it to the current timestamp in
HomematicBinding.execute(). If timestamps differ for more than 5 minutes --> perform reconnection. This works for me for about 24 hours now.

I will try to push my changes to my fork tonight. You can have a look at it then.

Regards,
Thorsten

Thorsten Gilfert

unread,
Dec 10, 2013, 1:27:01 PM12/10/13
to ope...@googlegroups.com, roger...@telia.com
Hello all,

I've created a pull request with my fix: https://github.com/thomasletsch/openhab/pull/1

Please have a look at it. It works for me but I'm not sure whether this is the best solution.

Regards,
Thorsten

Thomas Letsch

unread,
Dec 10, 2013, 2:38:30 PM12/10/13
to ope...@googlegroups.com
HI Falk,

hatte ich schon wieder fast vergessen mit dne ganzen Problemen die die CCU2 und der Themo Control macht. Ich schreibs mir aus, da Bug Einträge mit dem Move nach Eclipse gerade schwierig sind. Muss selber erst herausfinden wie das gehen sollte...

G.,
Thomas
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/F02sSMcEk0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.

Thomas Letsch

unread,
Dec 10, 2013, 3:05:38 PM12/10/13
to ope...@googlegroups.com, con...@thomas-letsch.de
sorry folks, that should have been sent by mail :-)

Thomas Letsch

unread,
Dec 10, 2013, 3:27:35 PM12/10/13
to ope...@googlegroups.com, roger...@telia.com
HI Thorsten,

thanks for the PR. I used it and created a new version with a reconnection every 5min. Its in my workspace branch. Perhaps you could have a look at it.

R.,
Thomas

Thorsten Gilfert

unread,
Dec 10, 2013, 3:37:40 PM12/10/13
to ope...@googlegroups.com, roger...@telia.com
Ok, I will try it tomorrow. Just for the record: I've fixed the timestamp update in my PR too.

Thomas Letsch

unread,
Dec 16, 2013, 12:24:55 PM12/16/13
to ope...@googlegroups.com, roger...@telia.com
BTW, another user (Thorsten Kamann) told me that has the TC with the CCU2 up and running with the CCU2 running on FW 2.7.8 (or whatever now the latest is) and the TC on FW 1.2.

I still need to update my TC and will test then more...
Reply all
Reply to author
Forward
0 new messages