Entity re-appears with wrong entity_id & name

I’ve recently re-organized my group addresses and am struggling to understand where Home Assistant is taking the entity ID and name from the sensor, after removing the entity altogether and adding the group address back with a different name.

For most addresses I’ve done the following:

  • Comment out entities in configuration
  • Reload KNX configuration
  • Remove entities from Home Assistant (config/entities)
  • Comment entities in configuration back in with correct group address and in some cases with corrected name.

This worked for most entities. However I’m currently struggling with a particular set of entities, which won’t work. I can remove them as described above, but once I add them back, they will re-appear with the previous entity_id.

I understand that the unique_id in case of knx is somehow bound to the group address. However I don’t get where the old entity_id is even taken from. I’ve even stopped Home Assistant, removed everything related to this entity_id from the core registry, and restarted Home Assistant and I’m still getting the entity back with the old (wrong) entity_id. I’ve grepped through everything within config and config/.storageand cannot find this old string anymore, so I’m wondering where this is taken from.

To be more specific. I have the following entity:

This is currently bound to this configuration:

knx:
  sensor:
    - name: "eg_kew_ta1_temperature"
      state_address: "3/2/5"
      type: temperature
      sync_state: expire 30

As you can see there is typo / mismatch in the name of the sensor eg_kew_ta1_temperature vs. it’s entity_id, which is eg_kew_ta1_temperatur (German spelling without e at the end.

Also it is being shown as EG-KEW-TA1 Temperatur in the overview:

I don’t understand where this name is coming from. Probably I’ve set it somewhere in the past, but I cannot find it by grepping through .config. Also I cannot just delete this entity (as you can see its greyed out).

Also I get an error in the log when trying to add this group address with another sensor / name:

I haven’t added this entity via Config Flow, as I’m configuring everything via YAML files.

By now I’m kind of lost where this entity is coming from and how I can remove it. I have similar such entities, so I would like to understand what is going on here. Re-setting everything is also not really an option at this point for me, since I don’t want to loose the history of everything and have quite a lot of thing set up (besides KNX).

Getting some instructions on where to look would be helpful. Thank you.

Hi :wave:!
Try to grep your knx sensor configs for the group address “3/2/5”. It is probably in use - maybe by another entity or you just have overlooked to remove the old instance of this config.

The name info for the entity name should be stored in config/.storage/core.entity_registry - you should be able to find it by searching for the string "unique_id":"3/2/5".

Re-organizing group addresses is not really a good idea with regards to the HA knx integration :grimacing: good luck!

I’ve already done this, but didn’t have a lot of success:

I can find the following entry when grepping for 3/2/5:

.storage/core.entity_registry:1395:      {"aliases":[],"area_id":null,"categories":{},"capabilities":null,"config_entry_id":"01JQ01ZC99X9QZQHAFRR0HDAZN","config_subentry_id":null,"created_at":"2025-03-24T21:11:12.038985+00:00","device_class":null,"device_id":null,"disabled_by":null,"entity_category":null,"entity_id":"sensor.eg_kew_ta1_temperatur","hidden_by":null,"icon":null,"id":"528149359e21795b6401b63b7119fd8e","has_entity_name":false,"labels":[],"modified_at":"2025-03-24T21:11:36.924054+00:00","name":null,"options":{"cloud.alexa":{"should_expose":false},"conversation":{"should_expose":false}},"original_device_class":"temperature","original_icon":null,"original_name":"EG-KEW-TA1 Temperatur","platform":"knx","supported_features":0,"translation_key":null,"unique_id":"3/2/5","previous_unique_id":null,"unit_of_measurement":"°C"}

Now I’m stopping Home Assistant:

ha core stop

Delete this line and restart Home Assistant again:

ha core start

Once Home Assistant is up and running again, I don’t find any entry for 3/2/5 within the core.entity_registry any more, but the sensor is still available (and getting data :slight_smile:) and still cannot be removed.

After a while (approx. 2-3 minutes) the entry is back again:

.storage/core.entity_registry:1395:      {"aliases":[],"area_id":null,"categories":{},"capabilities":null,"config_entry_id":"01JQ01ZC99X9QZQHAFRR0HDAZN","config_subentry_id":null,"created_at":"2025-03-24T21:19:54.408907+00:00","device_class":null,"device_id":null,"disabled_by":null,"entity_category":null,"entity_id":"sensor.eg_kew_ta1_temperatur","hidden_by":null,"icon":null,"id":"8558ab168dae1b940a5fcf785fc3dbd7","has_entity_name":false,"labels":[],"modified_at":"2025-03-24T21:20:17.246037+00:00","name":null,"options":{"cloud.alexa":{"should_expose":false},"conversation":{"should_expose":false}},"original_device_class":"temperature","original_icon":null,"original_name":"EG-KEW-TA1 Temperatur","platform":"knx","supported_features":0,"translation_key":null,"unique_id":"3/2/5","previous_unique_id":null,"unit_of_measurement":"°C"}

Probably the file is only written every now and then, so it doesn’t re-appear immediately. Either way it is somehow added back to the entity registry without me understand how and why.

Are there any other code paths in which a group address is mapped to an entity / sensor? Do you have any other suggestion on where to look and what to do?

Re-organizing group addresses is not really a good idea with regards to the HA knx integration :grimacing: good luck!

I know, but I still need to do this.

I’m happy to delete and re-add (and have already done) the KNX integration.

I’m happy to fiddle around within .storage.

Neither of which seemed to have helped in this case.

Also I don’t quite like the way the knx integration generates its unique_id, but it is what it is.

No idea where this comes from. I’d try this:

  • remove the entry from your knx sensor config
  • restart core (maybe twice), then the entity should still be there, but orphaned and you can delete it from the user interface
  • restart again
  • add the entry back to knx sensor config
  • restart again

Me neither, but I wouldn’t know any other way for yaml created entities. UI created ones use a different system.