Duplicated entities with different ID for the same device, how to purge?

Hi,

I’m currently testing the integration of a battery BMS device with multiple entities in Home Assistant using ESPhome.
During this process, I’ve integrated and removed the device several times, leading to a messy situation that I’m struggling to clean up.

The issue is that the same entity is present with different IDs. For example, this sensor appears twice with different IDs:

sensor.ble_jk_bms_can_ble_jk_bms_can_state_of_charge
sensor.jk_bms_ble_can_state_of_charge

This situation is affecting my Lovelace UI and Dashboard as the referenced IDs are not correct.

I’ve removed the device from ESPhome integration multiple times and rebooted HA, but no results.

Is there a way to clean up this situation and permanently remove the duplicate entities?

Thanks!
Davide

See if you can delete them in Settings → Devices & Services → Entities

I try to delete the zombie entities but I can’t select / delete since are “grayed out”
Can’t do anything with this entites in status “not avaialble”

It does not list those sensors as belonging to ESPHome.
Are you sure they are not created in your configuration YAML, as a helper or in Node Red?

They are creted via ESPHome
I have and ESP32 acting as battery management system and since I intgrate/remove the device few times due to some test/changes this create such a mess with duplicated entities
Same sensor but with two ID…
the point is that all my dashboard reference the old ID…don’t want to change…would like to remove the zombie, clean everthing and re-install

I am not enough versed in the inner workings of HA to guide you into the hidden folders and clean up there, so someone else have to help.
I just notice that in my HA ESPHome sensors are listed with ESPHome as integration and not just sensor.

Maybe this is the root couse of such a dupplication
I have integrated via EspeHome via IP address (and API Key)

I can see the devide under ESPHome

I can remove it…but the entities remain (even after HA reboot) !

thanks anyway for the support
hope to fix it somehow

I’ve removed duplicate entities by removing the item from the core.entities_registry file, in my case accessible via /opt/homeassistant/.storage/

Make a backup. Restart HA.