How to remove auto discovered switches?

here is the switch panel with sensors that were auto added by HA:

all but the last 6 of them are still active in my environment.
i searched the whole .homeassistant directory, but couldn’t find any file holding those sensors!
where are they stored/located? and how will i be able to remove them?

1 Like

They’ll be saved in your mqtt datababase. Clearing that will remove them from HA.

1 Like

What if we are using default embeded mqtt server? Don’t seem to find where to remove it…

i’m still struggling with that. i’m no DB admin or know how to manage those.
there must be an easier way?

image

none of them is there, and imho there is NO reference to any of these in any of my config files.

were the devices autodiscovered via mqtt ?

I was using this with Espurna, and it’s due to the persistent messages which are published to the homeassistant discovery topic prefix, in my case homeassistant

If you are setup like this, you can see what persistent HA mqtt discovery is there:
mosquitto_sub -h MY_MQTT_HOST -v -t HA_DISCOVERY_TOPIC_PREFIX/#

Then I could “delete” abandoned devices by publishing a persistent, null message to same “config” topic e.g.
$ mosquitto_pub -h MY_MQTT_HOST -r -n -t homeassistant/light/ESPURNA-DESKLAMP_0/config
(then restart HA to take effect)

where the topic, homeassistant/light/ESPURNA-DESKLAMP_0/config, was the thing that kept this thing showing up in HA after restarts.

^^ That sounds very “intuitive”…:wink:
I’m struggling with the same issue, but I guess a simple “remove” button in the Webui is just too easy?
Additionally, I cant locate the configuration file for these discovered switches.
Any ideas where to look?

1 Like

Where do I putt these lines? I use Hassio with Mosquitto addon and am stuck with some entity-id’s.

Thanks

Just in case anyone is looking at this later. The lines are done from the CLI using the SSH plugin (HASSIO). That said, you can use any MQTT client to Publish a blank retained message to the topic for your auto discovery for the device you wish to remove.
Auto discovery seems to use a retained MQTT message in order to configure the device. It works well, but is not the most intuitive thing to remove.