Homematic ccu3

Do you know if anyone has it working on SSL? Where it is now, using the config as above, Home Assistant hangs indefinitely.:

2019-02-09 21:15:45 INFO (MainThread) [homeassistant.loader] Loaded persistent_notification from homeassistant.components.persistent_notification,
2019-02-09 21:15:45 INFO (MainThread) [homeassistant.setup] Setup of domain introduction took 0.0 seconds.,
2019-02-09 21:15:45 INFO (MainThread) [homeassistant.loader] Loaded logger from homeassistant.components.logger,
2019-02-09 21:15:45 INFO (MainThread) [homeassistant.setup] Setting up logger,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic.connection] HMConnection: Creating server object,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] ServerThread.__init__,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] __init__: Creating proxies,
2019-02-09 21:15:46 INFO (SyncWorker_1) [pyhomematic._hm] Creating proxy rf. Connecting to 192.168.16.13:32001,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] LockingServerProxy.__init__: Getting local ip,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] LockingServerProxy.__init__: Got local ip 192.168.16.22,
2019-02-09 21:15:46 INFO (SyncWorker_1) [pyhomematic._hm] Creating proxy ip. Connecting to 192.168.16.13:32010,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] LockingServerProxy.__init__: Getting local ip,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] LockingServerProxy.__init__: Got local ip 192.168.16.22,
2019-02-09 21:15:46 INFO (SyncWorker_1) [pyhomematic._hm] Creating proxy groups. Connecting to 192.168.16.13:39292/groups,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] LockingServerProxy.__init__: Getting local ip,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] LockingServerProxy.__init__: Got local ip 192.168.16.22,
2019-02-09 21:15:46 INFO (SyncWorker_1) [pyhomematic._hm] Creating proxy ccu3. Connecting to 192.168.16.13:2001,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] LockingServerProxy.__init__: Getting local ip,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] LockingServerProxy.__init__: Got local ip 192.168.16.22,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__: iterating proxy = homeassistant-rf,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__: devices_raw = [],
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.createDeviceObjects: iterating interface_id = rf,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__: iterating proxy = homeassistant-ip,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__: devices_raw = [],
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.createDeviceObjects: iterating interface_id = ip,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__: iterating proxy = homeassistant-groups,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__: devices_raw = [],
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.createDeviceObjects: iterating interface_id = groups,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__: iterating proxy = homeassistant-ccu3,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.__init__: devices_raw = [],
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] RPCFunctions.createDeviceObjects: iterating interface_id = ccu3,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] ServerThread.__init__: Setting up server,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] ServerThread.__init__: Registering RPC functions,
2019-02-09 21:15:46 INFO (Thread-2) [pyhomematic._hm] Starting server at http://0.0.0.0:43955,
2019-02-09 21:15:46 DEBUG (SyncWorker_1) [pyhomematic._hm] ServerThread.proxyInit: init('http://192.168.16.22:43955', 'homeassistant-rf'),
2019-02-09 21:15:56 WARNING (MainThread) [homeassistant.setup] Setup of homematic is taking over 10 seconds.,

As a test, I setup a Pi 3 with a clean install of RaspberryMatic. Apart from setting up the firewall and creating the Guest user, I only created a Heating Test Group. I could not add any devices as I do not have a spare RF adaptor. My results:

As I have no BidCos or HM-IP devices on the Pi, I changed your script to ports 9292 and 39292. On port 9292 it fails with Got Interface: False.

On port 39292 is get this:

C:\Temp>ccu_test_jsonrpc.py
DEBUG:__main__:jsonRpcPost: Method: Session.login
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.54/api/homematic.cgi
DEBUG:__main__:Result: {'id': 0, 'version': '1.1', 'result': 'LL5WrQGEHw', 'error': None}
DEBUG:__main__:jsonRpcPost: Method: Interface.listInterfaces
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.54/api/homematic.cgi
DEBUG:__main__:Response: {'id': 0, 'version': '1.1', 'result': [{'name': 'VirtualDevices', 'port': 39292, 'info': 'Virtual Devices'}], 'error': None}
DEBUG:__main__:Got interface: VirtualDevices
DEBUG:__main__:jsonRpcPost: Method: Device.listAllDetail
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.54/api/homematic.cgi
DEBUG:__main__:Resolving devicenames
DEBUG:__main__:Handling device: INT0000001
DEBUG:__main__:Name: Test Group INT0000001
DEBUG:__main__:jsonRpcPost: Method: SysVar.getAll
DEBUG:__main__:jsonRpcPost: API-Endpoint: http://192.168.16.54/api/homematic.cgi
INFO:__main__:Variables: {}
DEBUG:__main__:jsonRpcPost: Method: Session.logout

So you can see my test group: DEBUG:main:Name: Test Group INT0000001

I conclude that RaspberryMatic defaults to SSL and that this breaks JSON name resolution on Home Assistant.

A clean installation of RaspberryMatic doesn’t have SSL enabled. I have RaspberryMatic (without SSL) and resolving names works just fine.

In your test, did you try this before enabeling SSL on RaspberryMatic? Maybe RaspberryMatic has a bug where the JSON-RPC API does not switch back to non-SSL once SSL has been enabled. If so, you should open an issue here: https://github.com/jens-maus/RaspberryMatic/issues

But I did not enable SSL on the test PI. To enable SSL, I presume you go to Control Panel, Network Setting and create the certifcate there. To confirm this, I reflashed my SD card and rebooted the Pi. I then navigated to the IP address using HTTPS and this is what I see:

So it already has a certificate and it is listening on port 443.

Ok, it wasn’t like this before. Maybe they started doing that later on when the CCU3 came along. Now that I’m testing this I have to agree that I can access via SSL, even though I have never setup any certificates. :confused:

Also, see here: https://github.com/jens-maus/RaspberryMatic/issues/59
RaspberryMatic generates self-signed certs from March 2017. I guess if were using RaspberryMatic before then, you would not have SSL enabled and the upgrades would respect that. I have been using it for 6 months sso I get SSL by default

Ok, to fix this in the test-script replace the line
if i['port'] == PORT:
with
if i['port'] in [PORT, PORT + 30000]:

To do the same in pyhomematic you have to change this line to:
if i['port'] in [self.remotes[remote]['port'], self.remotes[remote]['port'] + 30000]:

1 Like

Success! Thank you very much for sticking with this. It was a minor problem, but it bugged me for some time that I couldn’t get it to work. Well done!

Can I be a real pain and ask one more question? I have a HM-LC-Sw4-DR-2 4 channel relay to control heating and hot water. It looks like this:

But in Home Assistant only the parent name is used:

Central%20Heating%20Switch%202

Can it display the names of the child nodes? If not, no problem!

No, only the parent name is used when resolving names. You can however click on the entity so that the card opens. In the upper right corner there’s a gear-icon. If you click that you can rename the entity ID however your like.

No problem, I suspected as much.

@danielperna84 based on your description, I’ve now all the entities in HA, including the ccu3 as entity. Can you please support me to get the variables out of the ccu3 in a card to use. I didn’t find a way to use them in HA or to set the value for further use in Homematic.
best regards

This part of the documentation has en example that uses a sensor based on a variable on the CCU. That should get you started.

Thank you for the quick response. May I’ve explained my question the not specific …

I recently switched from ioBroker. In ioBroker, the variables were available as „normal" objects with an ID.

Here in HA the variables and the values are already available in the entity ccu3 (see picture). Isn’t it possible to display these values using something comparable to services? Additional it would be great, if in this special case not only the number of messages, but also the texts were displayed in a card. Thank you again for your support.
Bildschirmfoto 2020-05-28 um 12.04.14

You can make entities out of them by using themplate sensors. This is an example where I extract the valve-position from a thermostat. The same could be done with the attributes of the CCU-entity.

- platform: template
  sensors:
    sz_valve:
      value_template: '{{ states.climate.leq123456.attributes.valve }}'
      friendly_name: 'Foo Valve'
      entity_id: climate.leq123456
      unit_of_measurement: "#"

That’s not possible with the current implementation.

Thx! var reading works. now i have to do the var writing manually and automatically. Thanks again for your great support.

@danielperna84 Setting the variables somehow doesn’t work. Can you give me a simple example, with the e. g. the button-card ,to show how pressing a button is setting a bool. variable value “true”. This would be great. Thanks a lot in advance.

I don’t use variables, and I also don’t have any fancy lovelace-UI-stuff going on. So the only thing I can point you to is the example from the documentation: https://www.home-assistant.io/integrations/homematic/#examples

Sorry, but I do not understand how I can call or run the “service” called “Homematic.reconnect”…

CNY anyone help me? I had to restart my CCU, now my values are completely missing. How do manually start a new sync via API???

In developer tools, services, there should be that option (provided the integration properly loaded). Otherwise you can setup an automation calling a service.