How to remove inaccessible "zombie entities" after a esp device has been renamed?

I’ve renamed an ESP32 test device by changing the “long_devicename” in the config, and it’s now up and running with the new name.

However, all “entities” associated with the old test name are still there but unavailable thus had to be disabled manually.

Is there a way to delete those?

Settings → entities

Most of the times entity can’t be deleted by itself. Best and quickest way is to remove esp device and re-add it.

1 Like

Definitely not an expert, but in my experience it seems to take a restart of HA before the delete option exists. I’ve never had an old/unused entity that I haven’t eventually been able to delete. In my case, I normally just delete them at a later date when I happen to be looking at said devices entities and see old ones.

1 Like

I’ve restarted (rebooted) a number of times and tried to disable/enable them in different ways, but the same error message still appears and the entities cannot be deleted:

Only 0 selected entities can be removed! You can only remove 0 of the selected 3 entities. Entities can only be removed when the integration is no longer providing the entities. Sometimes you have to restart Home Assistant before you can remove the entities of a removed integration Are you sure you want to remove the removable entities?

Unfortunately, this is not the first time it happened to me using this integration and the same with some others as well. Presumably there are many others who also suffer from similar problems.

Anyone who knows what possible might be causing this problem so we can give a hint to the developers to fix this?

I’ll try that.

I’ve had similar problems with Tuya and it only worked out if I removed the integration and reinstalled it from scratch.

However, since I’ve been running HA for a while now, I’m afraid of losing my metrics if I have to remove an integration, or on a reinstall, some metrics might get new identities that don’t correlate with the previous ones.

Sensors/entities which stays the same (the ones you won’t rename) won’t be affected… just yesterday i removed and re-added one of my esp modules. All history from all entities which i didn’t change is still here.

1 Like

If it says 0 entities can be removed, then it is because it is bound to a device.
Click on the integration page and find ESPHome and make sure the old device is not still listed there.
Then restart the entire system and try deleting the entities again.

Sorry, tried that several times. The old entities are somehow still bound to the same device but using the old name thus are inaccessible after it’s renamed.

The only way that worked out was like Pavel explained, to remove the esp device and re-add it again.

1 Like