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.

@danielperna84

I am trying to get the names resolved also in ha and ccu. For some reason no matter what I try he does not resolve the names automatically. I have set names for all devices in the CCU and I tried using xml and json also in the configuration.yaml and I have no resolution for it.
On the CCU I have XML-API addon installed (version 1.20) but I don’t know if I need something special installed for json. If I go to http://ccu/api/homematic.cgi I see a table with lots of things so it looks that he has json stuff in there.
Is there something that I need to do also in order to have this all set up?
I would prefer if possible to have auto resolving of names cause I have 50+ devices and that takes quite some time to do it manually. Also the HA is rarely restarted ( maybe once 6 months) so I am not that afraid of the load.

Snippet of part of log related to this ( I cut some numbers from the names for security reason but you can see the patern how it’s not taking the names)

2021-02-11 00:18:41 WARNING (Thread-3) [pyhomematic._hm] Resolving names with the XML-API addon will be disabled in a future release. Please switch to json.
2021-02-11 00:18:43 DEBUG (SyncWorker_4) [pyhomematic._hm] RPCFunctions.newDevices: interface_id = homeassistant-ip, dev_descriptions = [{‘TYPE’: ‘HmIP-STHD’, ‘SUBTYPE’: ‘STHD’, ‘ADDRESS’: ‘000E98’, ‘RF_ADDRESS’: 427, ‘CHILDREN’: [‘000E98:0’, ‘000E98A9AA00D2:1’, ‘000E98:2’, ‘000E98:3’, ‘000E98:4’, ‘000E98:5’, ‘000E98:6’, ‘000E98:7’], ‘PARENT’: ‘’, ‘PARENT_TYPE’: ‘’, ‘INDEX’: 0, ‘AES_ACTIVE’: 1, ‘PARAMSETS’: [‘MASTER’, ‘SERVICE’], ‘FIRMWARE’: ‘2.6.0’, ‘AVAILABLE_FIRMWARE’: ‘2.6.0’, ‘UPDATABLE’: True, ‘FIRMWARE_UPDATE_STATE’: ‘UP_TO_DATE’, ‘VERSION’: 4, ‘FLAGS’: 1, ‘LINK_SOURCE_ROLES’: ‘’, ‘LINK_TARGET_ROLES’: ‘’, ‘DIRECTION’: 0, ‘GROUP’: ‘’, ‘TEAM’: ‘’, ‘TEAM_TAG’: ‘’, ‘TEAM_CHANNELS’: , ‘INTERFACE’: ‘’, ‘ROAMING’: 0, ‘RX_MODE’: 3}, {‘TYPE’: ‘MAINTENANCE’, ‘SUBTYPE’: ‘’, ‘ADDRESS’: ‘000E98:0’, ‘RF_ADDRESS’: 0, ‘CHILDREN’: , ‘PARENT’: ‘000E98’, ‘PARENT_TYPE’: ‘HmIP-STHD’, ‘INDEX’: 0, ‘AES_ACTIVE’: 1, ‘PARAMSETS’: [‘MASTER’, ‘VALUES’, ‘SERVICE’], ‘FIRMWARE’: ‘’, ‘AVAILABLE_FIRMWARE’: ‘’, ‘UPDATABLE’: True, ‘FIRMWARE_UPDATE_STATE’: ‘’, ‘VERSION’: 4, ‘FLAGS’: 1, ‘LINK_SOURCE_ROLES’: ‘’, ‘LINK_TARGET_ROLES’: ‘’, ‘DIRECTION’: 0, ‘GROUP’: ‘’, ‘TEAM’: ‘’, ‘TEAM_TAG’: ‘’, ‘TEAM_CHANNELS’: , ‘INTERFACE’: ‘’, ‘ROAMING’: 0, ‘RX_MODE’: 0}, {‘TYPE’: ‘HEATING_CLIMATECONTROL_TRANSCEIVER’, ‘SUBTYPE’: ‘’, ‘ADDRESS’: ‘000E98:1’, ‘RF_ADDRESS’: 0, ‘CHILDREN’: , ‘PARENT’: ‘000E98’, ‘PARENT_TYPE’: ‘HmIP-STHD’, ‘INDEX’: 1, ‘AES_ACTIVE’: 1, ‘PARAMSETS’: [‘MASTER’, ‘VALUES’, ‘LINK’, ‘SERVICE’], ‘FIRMWARE’: ‘’, ‘AVAILABLE_FIRMWARE’: ‘’, ‘UPDATABLE’: True, ‘FIRMWARE_UPDATE_STATE’: ‘’, ’

2021-02-11 00:18:46 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event platform_discovered[L]: service=load_platform.switch, platform=homematic, discovered=devices=[{‘platform’: ‘homematic’, ‘address’: ‘0001D8’, ‘interface’: ‘ip’, ‘name’: ‘0001D8’, ‘device_type’: ‘IPSwitchPowermeter’, ‘channel’: 3, ‘unique_id’: ‘0001D8A’}, {‘platform’: ‘homematic’, ‘address’: ‘0001D8A’, ‘interface’: ‘ip’, ‘name’: ‘0001D8A’, ‘device_type’: ‘IPSwitchPowermeter’, ‘channel’: 3, ‘unique_id’: ‘0001D8A’}, {‘platform’: ‘homematic’, ‘address’: ‘0001A’, ‘interface’: ‘ip’, ‘name’: ‘0001D’, ‘device_type’: ‘IPSwitchPowermeter’, ‘channel’: 3, ‘unique_id’: ‘0001D709’}, {‘platform’: ‘homematic’, ‘address’: ‘0007156A’, ‘interface’: ‘ip’, ‘name’: ‘0007156 2’, ‘device_type’: ‘IPMultiIO’, ‘channel’: 2, ‘unique_id’: ‘0007156 2’}, {‘platform’: ‘homematic’, ‘address’: ‘0007156A’, ‘interface’: ‘ip’, ‘name’: ‘00071569 3’, ‘device_type’: ‘IPMultiIO’, ‘channel’: 3, ‘unique_id’: ‘000715 3’}, {‘platform’: ‘homematic’, ‘address’: ‘000715A’, ‘interface’: ‘ip’, ‘name’: ‘000715A 4’, ‘device_type’: ‘IPMultiIO’, ‘channel’: 4, ‘unique_id’: ‘0007156 4’}, {‘platform’: ‘homematic’, ‘address’: ‘000715A’, ‘interface’: ‘ip’, ‘name’: ‘0007156A 6’, ‘device_type’: ‘IPMultiIO’, ‘channel’: 6, ‘unique_id’: ‘000715A 6’}, {‘platform’: ‘homematic’, ‘address’: ‘000715A’, ‘interface’: ‘ip’, ‘name’: ‘000715A 7’, ‘device_type’: ‘IPMultiIO’, ‘channel’: 7, ‘unique_id’: ‘000715 7’}, {‘platform’: ‘homematic’, ‘address’: ‘00071A’, ‘interface’: ‘ip’, ‘name’: ‘00075A 8’, ‘device_type’: ‘IPMultiIO’, ‘channel’: 8, ‘unique_id’: ‘00075A 8’}], discovery_type=homematic.switch>

Also for the Homematic IP CLOUD I know there is no support for HM-IP FAL actors but is it by any chance supported in Homematic? I would like to know when the pump starts and stops to put it in a dashboard. I see in the logs that he recognizes the device but I can’t find it in the gui nor in the devices in the developer tools

{‘TYPE’: ‘HmIP-FAL230-C6’, ‘SUBTYPE’: ‘FAL-C6’, ‘ADDRESS’: ‘00059709’, ‘RF_ADDRESS’: 454, ‘CHILDREN’: [‘00059709:0’, ‘0005970:1’, ‘0005970:2’, ‘000597:3’, ‘0005970:4’, ‘0005970:5’, ‘0005970B:6’, ‘0005970:7’, ‘000597:8’, ‘0005970:9’, ‘0005970:10’]

One last thing if I may please. Is there a way that I can import some system variable with related value into HA? Cause no matter how I try he does not take it in.

Variable that I have from sysvarlist.cgi

systemVariable name=“Water” variable=“31.750000” value=“31.750000” value_list=“” ise_id=“7804” min=“0” max=“65000” unit=“” type=“4” subtype=“0” logged=“true” visible=“true” timestamp=“1613006248” value_name_0=“” value_name_1=“”/>

Configuration for trying to get the variable picked up:

sensor:

  • platform: template
    scan_interval: 10
    sensors:
    water:
    value_template: “{{ state_attr(‘homematic.ccu2’, ‘Water’) }}”
    entity_id: homematic.ccu2
    friendly_name: “Water”

homematic:
interfaces:
rf:
host: 192.168.200.161
resolvenames: xml
username: Admin
wired:
host: 192.168.200.161
port: 2000
resolvenames: xml
username: Admin
ip:
host: 192.168.200.161
port: 2010
groups:
host: 192.168.200.161
port: 9292
resolvenames: xml
username: Admin
path: /groups
hosts:
ccu2:
host: 192.168.200.161
port: 2001
username: Admin

Doing some more debugging I notice on CCU2 that whenever I have homeassistant started it gives this error in the logs of CCU:

Feb 11 19:34:51 de.eq3.cbcs.legacy.bidcos.rpc.LegacyServiceHandler INFO [vert.x-worker-thread-2] (un)registerCallback on LegacyServiceHandler called from url: http://192.168.200.9:42849
Feb 11 19:34:51 de.eq3.cbcs.legacy.bidcos.rpc.LegacyServiceHandler INFO [vert.x-worker-thread-0] init finished
Feb 11 19:34:51 de.eq3.cbcs.legacy.bidcos.rpc.internal.InterfaceInitializer INFO [vert.x-worker-thread-0] Added InterfaceId: homeassistant-ip
Feb 11 19:34:51 de.eq3.ccu.virtualdevice.service.internal.rega.VirtualDeviceHandlerRega INFO [vert.x-eventloop-thread-4] (un)registerCallback on VirtualDeviceHandlerRega called from url: http://192.168.200.9:42849
Feb 11 19:34:51 de.eq3.ccu.virtualdevice.service.internal.rega.VirtualDeviceHandlerRega INFO [vert.x-eventloop-thread-4] Added InterfaceId: homeassistant-groups
Feb 11 19:34:51 de.eq3.ccu.virtualdevice.service.internal.rega.BackendWorker INFO [vert.x-worker-thread-9] Execute BackendCommand: de.eq3.ccu.virtualdevice.service.internal.rega.BackendUpdateDevicesCommand
Feb 11 19:34:52 de.eq3.cbcs.legacy.bidcos.rpc.internal.DeviceUtil INFO [vert.x-worker-thread-0] updateDevicesForClient homeassistant-ip → 309 device addresses will be added
Feb 11 19:35:01 de.eq3.cbcs.legacy.bidcos.rpc.internal.LegacyAPIWorker ERROR [vert.x-worker-thread-1] Can not handle request No handler with given name: getAllSystemVariables
de.eq3.cbcs.legacy.communication.rpc.RpcException: No handler with given name: getAllSystemVariables
at de.eq3.cbcs.legacy.communication.rpc.internal.rpc.AnnotationAwareRpcHandler.getMethod(AnnotationAwareRpcHandler.java:63)
at de.eq3.cbcs.legacy.communication.rpc.internal.format.xml.XmlRpcParser.parseMethodCall(XmlRpcParser.java:111)
at de.eq3.cbcs.legacy.communication.rpc.internal.format.xml.XmlRequestResponseProcessor.parseRequest(XmlRequestResponseProcessor.java:226)
at de.eq3.cbcs.legacy.bidcos.rpc.internal.AbstractLegacyAPIWorker.handle(AbstractLegacyAPIWorker.java:78)
at de.eq3.cbcs.legacy.bidcos.rpc.internal.AbstractLegacyAPIWorker.handle(AbstractLegacyAPIWorker.java:30)
at io.vertx.core.eventbus.impl.HandlerRegistration.deliver(HandlerRegistration.java:212)
at io.vertx.core.eventbus.impl.HandlerRegistration.handle(HandlerRegistration.java:191)
at io.vertx.core.eventbus.impl.EventBusImpl.lambda$deliverToHandler$3(EventBusImpl.java:505)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:337)
at io.vertx.core.impl.TaskQueue.lambda$new$0(TaskQueue.java:60)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

I think it comes from this code from the homematic component but I don’t know how to dig in deeper

def getAllSystemVariables(self, remote):
“”“Get all system variables from CCU / Homegear”“”
variables = {}
if self.remotes[remote][‘username’] and self.remotes[remote][‘password’]:
LOG.debug(
“ServerThread.getAllSystemVariables: Getting all System variables via JSON-RPC”)
session = self.jsonRpcLogin(remote)
if not session:
return
try:
params = {“session_id”: session}
response = self._rpcfunctions.jsonRpcPost(
self.remotes[remote][‘ip’], self.remotes[remote].get(‘jsonport’, DEFAULT_JSONPORT), “SysVar.getAll”, params)
if response[‘error’] is None and response[‘result’]:
for var in response[‘result’]:
key, value = self.parseCCUSysVar(var)
variables[key] = value

            self.jsonRpcLogout(remote, session)
        except Exception as err:
            self.jsonRpcLogout(remote, session)
            LOG.warning(
                "ServerThread.getAllSystemVariables: Exception: %s" % str(err))
    else:
        try:
            variables = self.proxies[
                "%s-%s" % (self._interface_id, remote)].getAllSystemVariables()
        except Exception as err:
            LOG.debug(
                "ServerThread.getAllSystemVariables: Exception: %s" % str(err))
    return variables

Thank you very much in advance and I really appreciate it

  1. Don’t resolve with xml, use json.
  2. You also have to set a password
  3. Make sure the firewall of your CCU allows connections
  4. The FAL-Actors are not supported I believe, and probably won’t be. I forgot the details, but if I recall correctly, they don’t provide useful data via the API.

@danielperna84

thanks for the reply. I appreciate it lots.

  1. I tried also to resolve it with json but without any luck. The devices are importing without problems in HA but with the ID’s and not the name :frowning: This is my config:
homematic:
  interfaces:
    rf:
      host: 192.168.200.161
      resolvenames: json
      username: Admin
#    wired:
#      host: 192.168.200.161
#      port: 2000
#      resolvenames: json
#      username: Admin
    ip:
      host: 192.168.200.161
      port: 2010
      resolvenames: json
    groups:
      host: 192.168.200.161
      port: 9292
      resolvenames: json
      username: Admin
      path: /groups
  hosts:
    ccu2:
      host: 192.168.200.161
      port: 2010
      username: Admin
  1. On the CCU I don’t have any password set. Is it required to have one set? Also if not, do I need to put password parameter in the configuration.yaml empty?

  2. Firewall is set to allow all. Capture74

  3. Thanks for the info.

  4. For the system variables, do you have any clue? I can’t get it to work to import the values in HA no matter what I tried.

Thanks lots in advance

Yes, you HAVE to set a password. You do that where you also set up the users that can access the CCU UI.

Variables use the same mechanism as resolving names via JSON. So as long as you don’t get the names to work, variables won’t work as well.

1 Like

@danielperna84 thanks lots again. Based on your suggestion I set a password in CCU and configured it in configuration.yaml and all works now with it. Amazing.

now I have 1 more question if I may.

The friendly names are set now but as attributes. Isn’t there a way to have them set as an entity? Guess is only possible if I set them manually in configuration.yaml?

Thanks

Your devices should be named something like light.livingroom etc… I don’t know why that doesn’t work for you if you don’t get errors.

Thanks for the answer. I checked and I don’t have any error but still the name is not filled. Anyhow, I will do it manually as you mentioned in other posts and it should be fine cause I only need to do it once.

  - platform: template
    scan_interval: 10
    sensors:
      low_battery_pelets:
        value_template: "{{ states('binary_sensor.00109709a8ea2c_low_bat') }}"

Guess this is what you meant. Thanks again

That looks like a HmIP device. In case your config from above is still somewhat accurate, you’re missing the credentials for your HmIP devices. The credentials have to be set for every interface. After all that could be a different CCU with different credentials.

But yes, I prefer the real IDs. They never change, whereas the named ones would change if you rename the device in the CCU, and then you’re wonderung why your automation has stopped working.

1 Like

Thanks lots again @danielperna84. Really much appreciated.

The config from above was adapted with correct things but still it’s the same. But I don’t mind it. I already mapped all devices to the entities and already put them in influx for nice display. Just for info, this is my current config:

homematic:
  interfaces:
    rf:
      host: 192.168.200.161
      resolvenames: json
      username: Admin
      password: xxxx
    wired:
      host: 192.168.200.161
      port: 2000
      resolvenames: json
      username: Admin
      password: xxxx
    ip:
      host: 192.168.200.161
      port: 2010
      resolvenames: json
      username: Admin
      password: xxxx
    groups:
      host: 192.168.200.161
      port: 9292
      resolvenames: json
      username: Admin
      password: sami1234
      path: /groups
  hosts:
    ccu2:
      host: 192.168.200.161
      port: 2010
      username: Admin
      password: xxxx