How to change KNX entity address without duplicating entity


I have been adding new entities (lights, sensors etc) to my Home Assistant setup by adding new entities into seperate knx.yaml which I include into configuration.yaml and everything works just fine. I’m using official KNX integration.

Now we had to rearrange almost all addresses in KNX environment so I need to update new addresses, state_addresses_ brighness_addresses etc in Home Assistant.

If I just update new address to knx.yaml and reboot Home Assistant it will create duplicate entities because unique_id is created based on address information.

How can I update just KNX addresses and keep current entities and sensor history graphs etc?

I disabled KNX integration before changing addresses in our system, but I would like to know how to fix entities before restarting KNX because I would like to avoid second entities at all cost :slight_smile:

Example in knx.yaml:

- name: "Living room light"
  address: "2/0/15"
  state_address: "2/0/16"
  brightness_address: "2/0/18"  
  brightness_state_address: "2/0/19"

And updated addresses should be:

- name: "Living room light"
  address: "2/0/1"
  state_address: "2/0/2"
  brightness_address: "2/0/3"  
  brightness_state_address: "2/0/4"

I found earlier topics but no actual answers were found. Change KNX group address --> new 2nd entity or KNX group address change not working

Thank you for your answers!

Hi :wave:!
First of all: make a backup!

Then you may try one of the following (I have not tested either and not sure if one of the two works):

  • Delete all knx entities and then load the knx integration without doing a restart of HA. I think this should preserve the history if you have not changed any entity_ids.
  • Shut down HA, edit config/.storage/core.entity_registry to change "unique_id" key of according entities. Restart HA and load the knx integration.
1 Like