Removing no-unique-id entity when integration no longer provides it?

I have spent many hours trying to clean up entity names messed up by the new MQTT naming that duplicates names and gives warnings, but in doing so have also caused a few entities to appear that no longer seems associated with MQTT but also no longer have unique ID’s and I cannot delete them.

Please see the screen shot below. The indicated two entities are not in MQTT or ESPhome. All remnants of the MQTT discovery and data topics have been removed. HA has been restarted many times. They show as read-only, complain that you cannot modify them from the UI. They act as though they are defined in YAML, but they are not – I have searched the whole config folder recursively and the name appears only in the database, no other files.

You cannot check the box, clicking it and using the gear switch says “Does not have a unique ID, therefore its settings cannot be managed from the UI”. Ok, probably correct at some point, but how do I make it go away now?

Well, that’s strange. Now a few hours later they have simply vanished. So… I guess never mind.

If you have removed all retained discovery topics from the mqtt broker then restarting home assistant should delete them.

I did that many times (from the menu, not the quick start). Didn’t. But they did vanish later. Not at all sure what happened, but solved now.