Find all renamed entitites? SQL or otherwise

Is there a mechanism that can give me a list of all entities that I have renamed in the GUI’s, specifically entity ID’s (not really concerned about generated entity names).

Or put another way, if I wipe out a device or integration, and re-add it and get all fresh names, a way to get an impact analysis of what I will need to re-name?

Linwood

I imagine the problem would be figuring out those default entity names and ids.

On a device level there are two attributes, name_by_user which as you’d imagine is the name set by the user, and just name which is the default name as provided by the integration (typically based in the device’s model name). Unfortunately there is nothing similar on an entity level as far as I have been able to find.

Someone who knows the HASS codebase could probably write a program to generate a massive list of default entities for every device type of every integration. Then you could use your current device names to generate the ids of all those default entities, and compare against which entities currently belong to each device.

But that is beyond my paygrade…

So “name” is I guess the friendly name, e.g. “Outside Flood Light” whereas the default entity name may be "light.outside_flood_light, and if I change the entity name to “light.outside_flood” that’s what appears in name_by_user and nothing retains light.outside_flood_light?

Do I have that right?

That’s awkward. I want to delete a bunch of entity names from esphome devices, but apparently can only do so by deleting the whole device (they sit there “unavailable” if I remove from the code). But if I delete the device and re-add it to clean up the entities, I have to have noted all the entity_id’s and then compare by hand, which is really tedious.

Cleaning up orphan stuff in Home Assistant is a royal PITA. :angry:

Thanks. Was hoping it was something simple. I haven’t dived into the database since the last time they did a major redesign, was hoping there was something simple.

Not quite, those properties are on the device level. On the entity level, there is only entity_id and friendly_name, and those only reflect their current values. There is no way to look up what the defaults were, at least with the tools available within a standard installation of HASS.

Now for many devices, like say a light, the default friendly_name of the “main” entity will be the same as the device name. Its entity_id will be the domain followed by a period (“light.”) and a stripped down version of the device/entity name, converted to lowercase and everything except letters and numbers stripped out and spaces replaced by underscores. But for devices that have more than one entity, and most tend to have at least a set of diagnostic entities, I don’t know any way of looking up what their default name/id suffixes are short of looking in the original source code.

Maybe there is an integration that can do it, who knows…

Thanks again. I guess the best I can do (lacking someone with a magic different answer) is the entity list. If I can suck that into a spreadsheet, then take a snapshot (I use a VM for HA) and remove the integration and re-add it, I can do an easy differences. Then rollback if it’s too much work to change in the GUI.

All this because of a ridiculous lack of a cleanup process for orphan entities.