Homematic - Resolving names

Hey there,

i just found HASS this night and it looks really great. Till yesterday I used Openhab2 and now i try to migrate my homematic and zwave installation here.

With the Homematic part I´ve got some troubles.

In the configuration.yaml i put the following:

   homematic:
      hosts:
        wireless:
          ip: 192.168.178.101
          resolvenames: json
          username: "XXX"
          password: "XXX"

I get tons of devices recorgnized by autodiscovery - all seems okay.

But they all have their serial_ID as Names. What do I have to do to change the names or even better get the names directly from the CCU? And another question: Could I use the settings within the CCU2 for rooms etc?

To demonstrate how my HASS now looks like, i put an Screenshot:

Could someone help me?

You don’t need to put the username and password into quotes. I’m not entirely sure, but it could be that this way they are also part of the used credentials, and “User” != User. Worth a try I guess.
A more stable way that performs much better would be to use the customize feature of HASS. As stated in the HomeMatic documentation for HASS, resolving names puts some load on the CCU. Especially when you’re trying out everything and restart HASS more often, resolving the names takes some time. So if you really plan on sticking to HASS, I would customize each entity manually. You usually only have to do that once. And when you add a new device, it’s only a matter of seconds to customize the new device.
A helpful tool for you could be my HASS-configurator. It has a list with all entities. That way you only have to select the device from a list without having to type the rather ugly device IDs.

As for the rooms: no, that’s not possible. HASS uses the XML-RPC API of the CCU, which Homegear emulates as well. And the rooms aren’t included in the data this API provides.

Hey Daniel,

thanks for replying.

Could you explain the “customizing-approach” a little bit further.

I tried the following lines:

  #Homematic auflösen
  customize:
    # Add an entry for each entity that you want to overwrite.
    switch.KEQ0170945:
      #hidden: true
  	friendly_name: Test

The log says “/home/homeassistant/.homeassistant/configuration.yaml”, line 19, column 3#033[0m

The mentioned line ist the friendly_name line.

What am I doing wrong?

Greetings Nic

YAML requires proper identation. If your configuration looks exactly like you have posted, then the friendly_name requirese two more spaces to be recognized as a child node for the switch-entity. So the same level as the out-commented hidden.

Hey, thank you that´s it.

But besides the customizing i still have trouble with the resolving:

Using JSON I get the following error:
[pyhomematic._hm] RPCFunctions.addDeviceNames: Unable to open session.#03
Using XML I get the following error:
Apr 16 09:17:22 raspberrypi hass[1476]: #033[33m17-04-16 09:17:22 WARNING (Thread-12) [pyhomematic._hm] RPCFunctions.addDeviceNames: Could not access XML-API: timed out#033[0m

Could you give me a hint?

For the JSON-method make sure the firewall within the CCU is properly configured (Einstellungen - Systemsteuerung - Firewall konfigurieren).
For the XML-API make sure the XML-API plugin is installed and opening http://yourccuaddress/config/xmlapi/devicelist.cgi shows a list of all devices.

If you’ve done all the customizing already, then don’t resolve the names. Resolving results in different entity IDs.

Thanks again. now it works. the names are resolved.

Perhaps it is a silly question, but where are all the entities stored? In the sqlite database?

Did I understand you right, that is could disable the resolving of names again, and then use the customizing? Or do I have some mismatch right now because of having tried every approach (non-resolving and resolving) ?
Watt do I have to tidy up?

The entities aren’t saved. They are “generated” every time a component loads them. For HomeMatic you can even pair new devices while HASS is running and they will be directly available. When you stop HASS all entities are forgotten. But the way the entities are generated is static, so f. ex. a thermostat device with the HomeMatic ID MEQ123456 will always get the entity climate.MEQ123456. That’s why you can use the customization reliably.
This changes if you choose to resolve names. When you do that and the device is named Heizung Wohnzimmer, then the entity ID will be climate.heizung_wohnzimmer. This usually works fine, although it takes some time to get all these names. And it has one big drawback: if you for some reason change the name on the CCU (f. ex. to HZG Wohnzimmer), then the entity ID will change to climate.hzg_wohnzimmer, which would break all the customizations, scripts and automations that used the old entity ID.

So yes, if you already have named your devices with name resolving disabled, do not turn it on. The entities the customization depends on aren’t available anymore when you switch. All the resolving really does is renaming the entities to what the CCU has in its metadata. But as stated above, that metadata can change if you choose to rename the device on the CCU. So not resolving + customizing is the most stable and performant choice. Admittedly, you have to deal with the uglier entity IDs in your automations etc., but that’s why I recommended the configurator, which lets you search by the friendly name, but it still adds the correct entity ID to your configuration.

Hi Daniel,

is it possible that all this changed since 2017? I’m resolving names via json and newly added devices get the friendly name like I named the device in the CCU. But the enitiy ID is still generated from the serial number. If I rename the device in the CCU the friendly name gets updated but the entity ID is still based on the serial number.

All my older devices have entity IDs based on the CCU device name. If I rename them in the CCU I have the same problem: the friendly name gets updated but the entity ID not.

Entity IDs only get created once. And it’s been the way it is for ages. The problem is, that HA notices the new devices pretty much immediately, and thus creates the entities based on the initial name. The only way to dodge this is to stop HA, pair the device with the CCU, give it a nice name, then start HA again. But as said before, it’s been like that for a long time. Or at least as long as we’re using static entity IDs (which wasn’t always the case because that concept just didn’t exist before).

Ahh, okay! This makes sense. I setup Homeassistant after adding 90% of devices to the CCU. Thank you.