How to reset/rebuild entity names?

Hi everyone,
I am moving all my devices around because I am switching from tasmota to esphome.

However, I first set all my device’s names solely as device-type+mac so I can flash them and then assign the proper names later. For some devices I used a name and then repurposed them.

This is now a problem because Home Assistant seems to keep the first names it received.

Now I have devices where the entity is named e.g. switch.office_printer but the device is the new fritzwlan-repeater. So device and entity do not match.

How can I reset this? Deleting the device and re-adding it did nothing.

See that button next to the ent ID? The one that looks like an arrow looping back counterclockwise? That’s reset entity ID. Click that and it resets the ent ID to something what matches the defaults (set your ent naming defaults in settings) according to the current device name v. Your settings.

So change the device name to your preference and if the device rename doesn’t rename your ents open the and hit that button then click update

That said. Your automations and or scripts may need a touch up once you change these. Consider entity_id like a key. Once you change these any script or automation based on them may (likely) need to be updated.

Keep in mind that if you recycle entity IDs, the new entity will inherit the history of the old. That’s fine for data in only the states tables, because that will be purged when it reaches your recorder’s retention setting (assuming you don’t have an insane value set for it you won’t have to wait too long), but for LTS it’s different and it will be retained indefinitely (manual clean-ups are possible for the adept).