Homematic ccu3

Setting it to info didn’t show anything, so I set it to debug. Logs can be downloaded here:
https://send.firefox.com/download/96aa2a1dda/#sMXApybdqPfXAbPWIR7EaQ

Thanks.

The link does not work for me. Please upload somewhere else.

Another thought: have you enabled SSL? In that case you have to use the jsonport parameter in the HASS configuration.

Sorry about that - try this one:

https://1drv.ms/u/s!AqAc-9PqwtFRtRMt3dzDxAzIBfuD

I was going to ask you about SSL, I created a certificate in Network Settings but it never downloaded. However, using https to access the CCU seems to work. What port should I use for jsonport - 443?

I tried 80 and 443 for the json port - different response each time but no device names.

Port 80:
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.addDeviceNames
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.addDeviceNames: Getting names via JSON-RPC
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: Session.login
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.16.13:80/api/homematic.cgi
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: Interface.listInterfaces
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.16.13:80/api/homematic.cgi
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.addDeviceNames: Got interface: False
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: Session.logout
2019-02-08 16:33:55 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.16.13:80/api/homematic.cgi
2019-02-08 16:33:55 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.switch: Handling OEQ0217421: None: [1, 2, 3, 4]
2019-02-08 16:33:55 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.sensor: Handling OEQ0674095: TEMPERATURE: [1, 2, 3, 4]
2019-02-08 16:33:55 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.sensor: Handling OEQ0675568: TEMPERATURE: [1, 2, 3, 4]
2019-02-08 16:33:55 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.climate: Handling OEQ1707598: None: [1]
2019-02-08 16:33:55 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.climate: Handling OEQ1707714: None: [1]
2019-02-08 16:33:55 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.climate: Handling OEQ1707715: None: [1]

Port 443:
019-02-08 16:41:08 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.addDeviceNames
2019-02-08 16:41:08 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.addDeviceNames: Getting names via JSON-RPC
2019-02-08 16:41:08 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: Session.login
2019-02-08 16:41:08 DEBUG (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.16.13:443/api/homematic.cgi
2019-02-08 16:41:08 ERROR (Thread-2) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Exception: Remote end closed connection without response
2019-02-08 16:41:08 WARNING (Thread-2) [pyhomematic._hm] RPCFunctions.addDeviceNames: Unable to open session.
2019-02-08 16:41:08 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.climate: Handling INT0000001: None: [1]
2019-02-08 16:41:08 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.climate: Handling INT0000002: None: [1]
2019-02-08 16:41:08 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.climate: Handling INT0000004: None: [1]
2019-02-08 16:41:08 DEBUG (Thread-2) [homeassistant.components.homematic] homematic.climate: Handling INT0000003: None: [1]

I assume 443 fails because it uses http instead of https. If I browse to http://192.168.16.13:80/api/homematic.cgi I get the Homematic JSON API.

A minor thing I just found: you have a duplicate entry in your configuration. wireless and rf. You only need one of those.

That’s the problematic line. Port 80 seems to be correct. But apparently the CCU3 returns different results than the CCU2. The relevant code in pyhomematic can be seen here.

I could only test this with the CCU2 and RaspberryMatic (which I though is pretty much the same as the CCU3). If you want to investigate further, you can use this test-script:

It does almost exactly the same as the libray does. In your case it should abort with Got interface: False. This has to be fixed. So maybe you figure out by playing around with the script and looking at the API the CCU3 provides.

Strange that the hardware would affect this. For the record I am running RaspberryMatic 3.41.11.20190126 on a TinkerBoard S. Here is the output from your test script:

C:\Temp>ccu_test_jsonrpc.py
DEBUG:__main__:jsonRpcPost: Method: Session.login
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.13/api/homematic.cgi
DEBUG:__main__:Result: {'id': 0, 'version': '1.1', 'result': 'Xw5oWC3eVu', 'error': None}
DEBUG:__main__:jsonRpcPost: Method: Interface.listInterfaces
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.13/api/homematic.cgi
DEBUG:__main__:Got interface: False
DEBUG:__main__:jsonRpcPost: Method: Session.logout
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.13/api/homematic.cgi

I’m afraid my programming skills are not up to debugging this, as I’m mainly a network/system hardware person. The call for Interface.listInterfaces looks correct according to the API page, but that is as far as I can take it. If you want I could arrange remote access to my CCU for you, or perhaps you could suggest what I could try?

Well, I use RaspberryMatic myself and it’s working perfectly fine. So there must be some local issue that I’m unable to track down. The only other problem I could image that Guest-access isn’t enough (it was with the CCU2). So maybe try the Admin-user instead of the guest user.

I had set the Guest account to have admin rights, but I tried using the Admin account with the same result. Does it seem reasonable that if I can browse to the api page on the CCU, then running your test script on the same computer should work, so we can rule out firewall settings, etc?

I tried a few other API calls with your script but get the same result. Also, I downloaded Homematic Manager and it can retrieve the device names from the CCU.
Is there any logging we can enable on the CCU to see what is happening?

Would the fact that the Tinkerboard S is probably responding much faster to API calls matter?

Yes. At least the firewall, because you’re able to login. And for the listInterfaces method guest access is sufficient in my case.

I don’t know about that. I have never seen it not working.

No.

In the testscript please add this line directly above LOG.debug("Got interface: %s" % interface):
LOG.debug("Response: %s" % response)

That way we can see what the actual answer is.

Port numbers look strange…

C:\Temp>ccu_test_jsonrpc.py
DEBUG:__main__:jsonRpcPost: Method: Session.login
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.13/api/homematic.cgi
DEBUG:__main__:Result: {'id': 0, 'version': '1.1', 'result': '11MbLlWCXP', 'error': None}
DEBUG:__main__:jsonRpcPost: Method: Interface.listInterfaces
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.13/api/homematic.cgi
DEBUG:__main__:Response: {'id': 0, 'version': '1.1', 'result': [{'name': 'BidCos-RF', 'port': 32001, 'info': 'BidCos-RF'}, {'name': 'VirtualDevices', 'port': 39292, 'info': 'Virtual Devices'}, {'name': 'HmIP-RF', 'port': 32010, 'info': 'HmIP-RF'}], 'error': None}
DEBUG:__main__:Got interface: False
DEBUG:__main__:jsonRpcPost: Method: Session.logout
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.13/api/homematic.cgi

You have SSL enabled. With enabled SSL you have to prepend the port with a 3. So 2001 becomes 32001, 2010 becomes 32010 etc…

Strange, I only enabled it this morning. Anyway, changing the port on your test script returns device names now. Still struggling with getting it to work on HA…

This is proving frustrating! Your script works fine on port 32001, but if if put 3 in front of the port numbers in confguration.yaml, HA hangs:

019-02-09 16:38:03 DEBUG (SyncWorker_1) [pyhomematic._hm] ServerThread.proxyInit: init('http://192.168.16.22:39823', 'homeassistant-rf')
2019-02-09 16:38:13 WARNING (MainThread) [homeassistant.setup] Setup of homematic is taking over 10 seconds.
2019-02-09 16:40:14 DEBUG (SyncWorker_1) [pyhomematic._hm] proxyInit: Exception: [Errno 110] Connection timed out
2019-02-09 16:40:14 WARNING (SyncWorker_1) [pyhomematic._hm] Failed to initialize proxy
2019-02-09 16:40:14 DEBUG (SyncWorker_1) [pyhomematic._hm] ServerThread.proxyInit: init('http://192.168.16.22:39823', 'homeassistant-ip')

Without the 3, HA starts up fine but no device names. I deleted the cert off the CCU and rebooted it, but your script still requires port 32001.
Is there anything else I need to do to remoce SSL from the CCU?

I seems like HA is using 2001 for the ccu3 hosts entry in configuration.yaml. Is there a way to change that:

2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic.connection] HMConnection: Creating server object,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] ServerThread.__init__,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] __init__: Creating proxies,
2019-02-09 17:02:09 INFO (SyncWorker_6) [pyhomematic._hm] Creating proxy rf. Connecting to 192.168.16.13:32001,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] LockingServerProxy.__init__: Getting local ip,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] LockingServerProxy.__init__: Got local ip 192.168.16.22,
2019-02-09 17:02:09 INFO (SyncWorker_6) [pyhomematic._hm] Creating proxy ip. Connecting to 192.168.16.13:32010,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] LockingServerProxy.__init__: Getting local ip,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] LockingServerProxy.__init__: Got local ip 192.168.16.22,
2019-02-09 17:02:09 INFO (SyncWorker_6) [pyhomematic._hm] Creating proxy groups. Connecting to 192.168.16.13:39292/groups,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] LockingServerProxy.__init__: Getting local ip,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] LockingServerProxy.__init__: Got local ip 192.168.16.22,
2019-02-09 17:02:09 INFO (SyncWorker_6) [pyhomematic._hm] Creating proxy ccu3. Connecting to 192.168.16.13:2001,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] LockingServerProxy.__init__: Getting local ip,
2019-02-09 17:02:09 DEBUG (SyncWorker_6) [pyhomematic._hm] LockingServerProxy.__init__: Got local ip 192.168.16.22,

It’s actually also using the 3xxx variants. You just have a 4th entry in your configuration that still uses port 2001. In that log you have 4 lines that say Connecting to .... The first 3 times it’s correct. Just the last one is a duplicate. I have mentioned earlier in this thread, that your config has a duplicate entry. Remove that before doing anything else.

I don’t know. I have never enabled it here.

I took that out this morning. From the logs, it looks like it processes each entry in turn and only fails on the fourth one, so that’s why I think the ccu3 entry is using port 2001. Here’s my current setup:

homematic:
interfaces:
rf:
host: 192.168.16.13
port: 32001
ssl: true
resolvenames: json
username: Guest
password: *****
ip:
host: 192.168.16.13
port: 32010
ssl: true
resolvenames: json
username: Guest
password: *****
groups:
host: 192.168.16.13
port: 39292
ssl: true
resolvenames: json
username: Guest
password: *****
path: /groups
hosts:
ccu3:
host: 192.168.16.13
username: Guest
password: *****

Sorry, the indenting didn’t come across correctly, but it parses OK.

You’re right. Entries in the hosts-section of the configuration always use port 2001. I gues that should be configurable. But since it’s part of the hosts-section it’s not related to your problem.