Remove old MQTT device trackers after 2022.06.0 syntax upgrade

Hello,
I have upgraded to 2022.06.0 recently and based on the changelog I updated the syntax of my MQTT devices from:

device_tracker:
  - platform: mqtt
    devices:
      espresense_phone_jerry: "device_tracker/espresense_phone_jerry"
    source_type: bluetooth_le  

to:

mqtt:
  device_tracker:
    - name: espresense_phone_jerry
      device:
        identifiers:
          - XXXXX
          - "xx:xx:xx:xx:xx:xx"
        manufacturer: samsung
        model: SM-G991B
        connections:
          - ['mac', 'xx:xx:xx:xx:xx:xx']
        
      state_topic: "device_tracker/espresense_phone_jerry"
      source_type: bluetooth_le
      unique_id: espresense_phone_jerry
      qos: 1 

Now my problem is that this created the second device_tracker.espresense_phone_jerry_2 entity and I am unable to delete the old one, since the old syntax didn’t allow specifying the unique_id.
I went through the typical files to delete the old entities, however after restart the old entities are still present.

I looked through these files:

/config/.storage/core.device_registry
/config/.storage/core.entity_registry
/config/known_devices

I also deleted the states from database and made sure there are no MQTT retained messages.

Is there any other location where these entites could be stored?
I even tried removing the old syntax and new syntax, then deleting all of these entities from those files, restarted HA, thinking all of them would dissappear, but still the old ones and the new ones are present in HA.

Thank you

Had the same issue and at the end deleting the known_devices.yaml fixed it for me.
Did you stop HA when editing the .storage/cor* files?

1 Like

Thanks for the response.
I didn’t stop the HA because I was using Samba add on to edit the file, however I restarted HA right after editing the file. Also I didn’t delete the whole known_devices file, just removed the entries about these entities.

Nonetheless I left it as it was yesterday, didn’t touch the HA and later that day I came back and the entities were gone. Not sure if HA is doing some cleanup on the background or maybe it was a browser cache issue, it just fixed itself. I then just reenabled the new syntax configuration.