ESPHOME and api

I have just started using esphome (was using Tasmota with mqtt) with api. The discovery in home-assistant (HA) finds my new devices. The problem is that I am experimenting and creating new devices to replace previous devices and discovery never lets go of the old devices that do not exist any more. This confuses Alexa and creates version two devices with same name. I really need a way to cleanup discovery and really remove dead/old/previous devices from HA as a whole. I hope there is a good solution, otherwise, back to mqtt for everything and kill discovery. Where can I learn about discovery and api use? Thanks, Doug

1 Like

Go into the entity registry from the frontend and remove the entity that you’re replacing before adding the new one that replaced it. You may have to reboot a couple times. Worst case scenario, just delete the entity registry file in your .storage folder and reboot HA.

If the original Tasmota device used discovery you will also have to remove the retained MQTT config topics and messages from your broker before adding the new device.

It was too late to remove before installing new device so I deleted the entity file in .storage directory. That did not clear all the old devices stuck in discovery. I have multiple copies of incorrect devices mixed with my correct device and nothing in the front end lets me get rid of the problem devices. How can I flush the retained mqtt and api ghosts. I am inoperable now and Alexa is so confused :unamused:
I sure need help badly.

If the entity and/or the ESPHome integration for that device is no where in the frontend entity registry or integration list and you have rebooted then you can delete the entire entity registry file (not just the ESPHome created file) From .storage and let HA rebuild your entity registry after a reboot. The downside to doing this is any renaming, customizing, etc done from the front end to any other integration or entity will also be deleted. But at least all old copies of now missing entities will be removed.

1 Like

OK Thank you, I am back up and working. I will be careful to flush the old before installing the new from now on.

I appreciate the help you gave me, Doug