How to completely remove a device?

I am testing the transition of my Sonoff switches from ESPurna to ESPHome.

  • ESPurna uses MQTT to communicate with HA
  • ESPHome has a native API to integrate with HA

I have one test switch (switch03) on which I experimented the transition and after trying this and that ended up with two entries for switch03:

image

This means that I end up with the entities switch.switch03 (the MQTT one) and switch.switch03_01 (for the ESPHome one).

My question is: how to effectively remove both devices so that I can start clean and switch.switch03 refers to the ESPHome one (the only one).

I tried to remove it via the GUI, but switch.switch03 is somehow internally wired to the first one it saw (the ESPurna MQTT) and won’t let the name go.

I am ready to break things if this is the only solution (I already envisionned deleting .storage as it will probaby be stored there.

It seems that going though the web interface way actually works.

I tested on another switch:

  • removed all MQTT entries (I do not use autodiscovery - I am not sure what would happen then)
  • removed the MQTT device
  • removed the ESPHome integration

I do not have devices anymore

  • added the ESPHome integration back

→ now the switch has the right, default name (without _01)