Homematic CCU2 several issues

Dear hass community,

I’m quite new to hass and currently struggling with the homematic integration.
I hope someone can help me with my current issues:

  1. In the phase of testing I’m often restarting the hass service. This often leads to more than 30 “Servicemeldungen” showing unavailable devices. (I currently have more than 90 devices installed)
    Is there any option to avoid this on restarting hass?
    My current configuration:

homematic:
delay: 1.0
hosts:
rf:
ip: 192.168.178.20
resolvenames: json
variables: true

  1. I had 2 times, that the connection seems to be broken between HASS and the ccu2.
    This is noticeable, that the switches toggles back and the last update was long ago.
    Calling homematic.reconnect seems to fix the issue.
    Any idea why this is happening?

  2. Is there a possibiliy to rename the devices and instead use the name light.leqXXXXX something more user friendly like light.kitchen?

Thanks for your help.

  1. Restarting HASS shouldn’t produce Servicemeldungen. HASS just reads the data from the CCU, and writes on demand, which should not be the case when you’re just restarting. We are talking about the Servicemeldungen you also have in the UI of the CCU, correct?
  2. There is no final answer for that. There can be many reasons why the connection is dying. First of all this will happen if you restart the CCU while HASS is running. HASS doesn’t automatically reconnect if the connection has been closed. Another reason could be an instable network connection. If the machine HASS is running on is connected via WiFi and for some reason the connection drops, HASS won’t reconnect as well. It just depends on your setup why this is happening, and possibly monitoring the circumstances to have an automation that reconnects to the CCU.
    Another reason may also be, that a setup with ~90 devices can be considered rather big. The CCU on the other hand isn’t very powerful. So it may also be, that the CCU drops connections because it’s too busy with all that’s going on internally. This actually is a reason to integrate HASS. That way you cann offload your automations to HASS and use the CCU just for communicating with the devices.
  3. Looking at your configuration you actually already fetch the device names from the CCU. So you should already get “Küchenlampe” if you have set that as the device name in the CCU. For this to work though, you also have to set the credentials mentioned in the HomeMatic documentation for HASS. resolvenames by itself doesn’t work. So if that is missing, that’s why you get the LEQ123456 names.

Hallo Daniel, vielen Dank.
Thanks you very much for your prompt response and thank you for the work done with this component.

  1. yes the Servicemeldungen form the CCU UI. I had this issue now two times right after restart. Since I added a delay of 2.0, it seems that the issue did not appear again. Does this somehow makes sense?

  2. Thanks for the hint regarding the connection issue. I now switched from Raspberry Pi Wifi to LAN. Maybe this improves the communication. Is there any action I can perform to automate the reconnect in cases the connection is dying?
    I can think of some cases where this may happen. e.g. CCU Firmware update, Power outage, Router firmware updates

  3. I unfortunately still get the Serial numbers. It took my now several hours to use the customize feature to set friendly names.
    I found in the logfile:
    WARNING (Thread-13) [pyhomematic._hm] RPCFunctions.addDeviceNames: Unable to open session.
    On the CCU2 I found following error in Systemlogs at the almost same time:
    homematic-ccu2 user.err rfd: XmlRpc fault calling system.listMethods({“homeassistant-wireless”}) on http://192.168.178.29:8999/RPC2:[faultCode:1,faultString:“<class ‘TypeError’>:system_listMethods() takes 1 positional argument but 2 were given”]
    Any possibility to debug this further, why this is not working?

My current configuration:

homematic:
delay: 2.0
local_ip: 192.168.178.29
local_port: 8999
hosts:
wireless:
ip: 192.168.178.20
resolvenames: json
variables: true
username: !secret ccu_user
password: !secret ccu_password
(config verfied with hass --script check_config --secrets)

  1. Now that you mention it: yes, I’ve heard of that before. That’s actually why we added the delay-parameter. The CCU isn’t powerful enough to answer HASS quickly enough when there are a lot of devices. The delay causes HASS to wait between each device to give the CCU the time to deliver the data.
  2. That’s hard to say. It depends on what the actual cause for the dropped connection is. If you do ifconfig and see “dropped” packets there, you could react to that. Or check if netstat -s | grep discarded changes over time. This would be helpful if it’s the Pi that’s having the issues. But it could also be the overloaded CCU that’s dropping the connection for some reason. In that case something simliar like above, but done on the CCU could be helpful.
    What I would do: have a ping 1.2.3.4 (from the Pi to the CCU) running all night, and check back to see if there where pings that didn’t reach the CCU. If yes, then you know for sure that the issue has something to do with your connectivity. How you’re going to monitor that depends on how much effort you plan to invest. The first things that comes to my mind is Nagios (german link).
  3. My personal opinion: stick to the serials and use customization. Fetching the names takes up more time and puts even more load on the CCU. Especially with your 90 devices it’s a good idea to spare the CCU from too much work. If you use my configuration tool you’ll have a list of entities together with their friendly names. So once you have set them all up it doesn’t make a big difference if you fetch the names or not.
    Anyways, that error you get is new to me. If you get that, everybody else fetching names should get that error as well. And so far nobody has reported that error. Is your CCU updated to the latest firmware?

Hy Daniel,

thanks for the feedback.
I general the component is working like a charm. The response times are perfect, since I reduced the amount of program on the CCU2 and replacing bit by bit with HASS.

Would you mind to share your HASS configuration regarding homematic topics? This would be very helpful for me to move faster forward. :slight_smile:

  1. Since I switched to LAN Ethernet I had no more issues. Is there any Event I could use in cases of connection broken. This would allow me to automate the homematic.reconnect in such cases.
  2. Thanks for the tool. Will have a look at this.
    I’m using CCU2 with latest Firmwareversion 2.25.15.
    If you need anny additional information, please let me know.
  3. Something new:
    I noticed following issues with my two HM-ES-PMSw1-Pl devices.
    They show up as normal switches and sensors and are general working.
    The logfile nevertheless sometimes shows following: (Serial replaced with KEQ0000000)

17-03-11 12:25:54 ERROR (Thread-1) [pyhomematic.devicetypes.generic] HMGeneric.getValue: POWER on KEQ0000000:2 Exception: <Fault -1: ‘Failure’>
17-03-11 12:25:54 ERROR (Thread-1) [pyhomematic.devicetypes.generic] HMGeneric.getValue: CURRENT on KEQ0000000:2 Exception: <Fault -1: ‘Failure’>
17-03-11 12:25:55 ERROR (Thread-1) [pyhomematic.devicetypes.generic] HMGeneric.getValue: ENERGY_COUNTER on KEQ0000000:2 Exception: <Fault -1: ‘Failure’>
17-03-11 12:25:55 ERROR (Thread-1) [pyhomematic.devicetypes.generic] HMGeneric.getValue: VOLTAGE on KEQ0000000:2 Exception: <Fault -1: ‘Failure’>
17-03-11 12:25:55 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 205, in async_update_ha_state
“No entity id specified for entity {}”.format(self.name))
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity KEQ0000000
17-03-11 12:25:55 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 205, in async_update_ha_state
“No entity id specified for entity {}”.format(self.name))
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity KEQ0000000
17-03-11 12:25:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 205, in async_update_ha_state
“No entity id specified for entity {}”.format(self.name))
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity KEQ0000000

Uhm, my HomeMatic configuration is rather minimal:

homematic:
  hosts:
    hmrf:
      ip: 192.168.1.23
      username: Admin
      password: ****
      primary: true
      variables: true
    hmip:
      ip: 192.168.1.23
      port: 2010

I don’t resolve names to put less load on the CCU while starting. And I have a second host for IP devices. Nothing fancy. Some of my automations:

- alias: "Küchenrollo runter bei Sonnenuntergang"
  trigger:
    platform: sun
    event: sunset
    offset: "00:30:00"
  action:
    service: cover.close_cover
    entity_id: cover.jrt123456
- alias: "Tür geöffnet"
  trigger:
    platform: state
    entity_id: binary_sensor.keq321654_state, binary_sensor.keq123456_state, ...
  action:
    - service_template: >
        notify.{{ trigger.entity_id[14:] }}
      data_template:
        message: >
          {{ trigger.to_state.state }}
- alias: "Bad Luefter an"
  trigger:
    platform: numeric_state
    entity_id: sensor.meq987987_humidity
    above: 65
  action:
    service: switch.turn_on
    entity_id: switch.meq654654
- alias: "Flur Licht an bei Bewegung"
  trigger:
    platform: state
    entity_id: binary_sensor.meq456654_motion
    to: 'on'
  condition:
    condition: or
    conditions:
      - condition: sun
        after: sunset
      - condition: numeric_state
        entity_id: sensor.meq789987_brightness
        below: 110
  action:
    service: light.turn_on
    entity_id: group.flur
- alias: "Schlafzimmer Licht toggle"
  trigger:
    platform: event
    event_type: homematic.keypress
    event_data:
      name: MEQ963258
      channel: 1
      param: PRESS_SHORT
  action:
    service: light.toggle
    entity_id: light.schlafzimmer
  1. No, there is no event you can base automations on. But since you have a lot of devices, you probably also have some brightness sensor. You could have an automation that triggers if the brightness of that sensor has been the same for 12 hours or so. During the course of the day that sensor should update its value multiple times a day. And since the sun does it’s job even when you’re away a couple days, that would be more reliable than basing the automation on a motion detector. Anyways, you know the connection has dropped when the devices in HASS don’t update anymore. You can still control them from HASS, even when the connection has dropped, you just don’t get the feedback that it has worked.
  2. The error is a result of not being able to properly open an authenticated session for the JSON-RPC API of the CCU. Since you have the credentials set up properly: have you configured the CCU to allow connections? I don’t know from the top of my head, but I believe there’s some sort of “firewall” in the CCU for which you can configure who is able to use certain functions remotely.
  3. I’ll mention @pvizeli and hope he’s having a look at this. He’s the one who has done the integration on the HASS side. Even if those errors don’t result in faulty behavior, unhandled exceptions shouldn’r occur I guess.

Thank you very much.

The System is running without any noticeable issue for more than one week. Great.

But have have currently two more open thing, where I hope you may be able to help me:

  1. My HM-LC-RGBW-WM does not show up in HASS. Any idea, why this device is missing?
  2. The HM-LC-Sw1-Pl-CT-R1 opens the garage door as expected but stay in the state on. This leads to an state where the manual switches doesn’t work any more for e.g. stopping the door at all.
    The device is configured to go to the state off within 0.5 sec. This works for the homematic remotes and the switch which is directly on the device. Any idea why this issue occurs with HASS?
  1. The HM-LC-RGBW-WM is one of the devices that are currently not supported. Some of the devices that don’t work so far can be seen here: Device support
  2. I believe that’s because of the 0.5 sec setting. I have a similar switch, which I set to either on or off, so not with the on-time setting. And that’s working fine. Don’t know where the exact issue is in this case. Have to investigate once I find the time. Could you post the exact settings you have for that switch so I can replicate them?

Dear Daniel,

  1. Thanks for pointing this out.
  2. Those are the settings from the CCU.
    Sorry regardgin the 0.5 sek. The acutal value is 0.4 sec.
    Once I trigger the button or use any “Dirketverknüpfung” the switch goes off within the configured time automatically. The issue I have is the security feature like stopping the garage door with the manual switch or from the optical barrier wont work any more.
    If you can have alook, this would be great.

I think I need some clarification on how you have set up those security features.
With the switch I have (HM-LC-Sw1-FM) it is as following (with the only configuration difference being it set to “unendlich” for “Verweildauer…”):
I have a consuming device attached. When I trigger the device through the HASS UI, the switch flips to on - delivering power to the device - and stays in that state until I trigger the UI-switch again. I also have a physical button (Taster, not Schalter) attached to it. If I press the button, it flips the state of the switch the same way as the virtual switch in the UI does.
If I compare that to your setup, is the switch/button you have attached connected like I have the button connected and it should, not considering “Verweildauer”, behave like my setup? And how is the optical barrier related to all this? Through an additional sensor which is doing its task through programming in the CCU?

First of all thank you very much for spending so many time on this.

The motor of my garage door has 2 inputs. First input is for the optical barrier and the second input is for manual switches (Taster)
On the second input two manual switches and the HM-LC-Sw1-Pl-CT-R1 are connected in parallel.
Each impulse on the second input will trigger the motor (Down, Stop, Up, Stop, Down, etc…)
If one of the inputs are pressed for a longer time, any other impulse (also from the first input) is ignored. This has nothing to do with Homematic at all and seems to be a limitation of the motor interaces.
The only thing I want to make sure is, it that the HM-LC-Sw1-Pl-CT-R1 changes automatically to off after 0.4 sec every time it is switched to on, like the internal switch (Taster) or the wireless controll (Handsender).

Is there any possibility to use this build in toggle feature?
Otherwise I need to set up an hass automation, to switch it off again, once it reports the state on.

I think I found the problem (visible in your screenshot as well):

Programmierung der internen Gerätetaste

The settings you can configure in the CCU only apply to physical buttons attached to the device. If you go to “Status und Bedienung” and from there to the device, you can turn it on and off there as well. If you turn it on with the UI button the switch is staying in the on-state as well. So what you want to do has to be done using an automation.

I found this thread that deals with a similar issue, and within the CCU the problem is solved with a virtual button of the CCU. So, uhm, it seems as if there is nothing I can do about that besides suggesting to solve the issue using some workaround. :pensive: