Repairs: detect and resolve entities that have become unavailable, replaced with _2 entities

Just spent the last half hour going over a bunch of entities that somehow got renamed after the last reboot to rename them #87797.
TL;DR: Quite the list of entities had become unavailable, and had new entity IDs popped up with _2 added to them.

Of course it would be nice if such bugs could be squashed, but also this issue could pop up based on user actions (e.g. renaming of a device outside of HA config, causing its entities to be freshly registered as new).
For those cases it would be a great addition if HA could detect if all entities of a device or integration had become unavailable, and a bunch of new ones popped up with the _2 postfix.
Having a repair to bulk rename all these entities back to the original entities is what I’m looking for. Bonus points if somehow the history data could also be merged of course :slight_smile:

Indeed . Cleaning the entity view is a must have !