Delete (MQTT) entities?

Hello!
I have a problem I have some old entities that cannot be deleted.
Which way is there?

These are old devices in the MQTT integration, you can select and deactivate them, but you cannot delete them.
All the ways I tried don’t work.

greetings
Gerald

Were the old entities manually defined (perhaps in your configuration.yaml file) or were they automatically discovered?

  • If they were manually defined, delete them from the configuration file.

  • If they were automatically discovered, purge their MQTT Discovery topic. Use an MQTT client, like MQTT Explorer, to determine if there is a topic on your broker like homeassistant/sensor/name_of_your_sensor/config. If there is, use MQTT Explorer to delete it.

9 Likes

Thank you!

Now it looks clearer again, they were automatically recognized!

greetings
Gerald

Thanks, very helpful! You can also just send an empty payload in the MQTT integration to the config topic now

Yes, that’s the fundamental way of purging a retained payload from an MQTT topic (publish an empty string as a retained message).

https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/

1 Like

Yes an old post but it doesn’t work for me. Addon: amcrest2mqtt

After installation there are 30 Devices.
Mos_Broker_0

Mos_Broker_1

Then I use MQTT Explorer and deleted the whole Amcrest AD110 entry
MQTT_Explorer

Everything seemed fine - 29 Devices
Mos_Broker_2

But after a HA Restart I saw Amcrest AD110 again under MQTT and there are 30 devices again.

Then I tried to erase the device …
MQTT_1

but I get: Device not found
MQTT_2

I have tried:

  • Mosquitto broker Restart
  • HA Restart
  • Host Restart

I repeated the process several times but the result was always the same. Amcrest AD110 keeps popping up.

Where is the problem? Did I do something wrong?

I don’t know anything about the amcrest2mqtt addon but my guess is it simply recreates the MQTT topics you deleted. Ask the addon’s author for assistance.

Thanks for the reply. Yes I think somewhere there has to be still an entry in HA itself that keeps recreates the Amcrest Addon after a reboot/restart. But where? No not at configuration.yaml. This entry ensures that the device is always re-entered under HA Mosquitto broker, even though there is no longer an entry in the MQTT database and although the integration was uninstalled.

I was hoping that someone here would have an idea where else I could look/search in HA.

Addon author: https://github.com/ikifar2012/amcrest2mqtt-addon/issues/7

Uninstall the amcrest2mqtt addon and delete any of its remaining MQTT topics. After a reboot, none of it should return.

If you delete the topics but leave the addon installed, a reboot is likely to make the addon re-publish the topics.

I’ve tried all that.

  1. Settings → Addon → amcrest2mqtt → I deleted the addon.
  2. HA restart = No amcrest2mqtt addon under Addons.
  3. Mosquitto broker MQTT = Entry for amcrest (still) available. → Try to delete the entry under Mosquitto broker MQTT Devices = Device/Service not found.
  4. MQTT Exlorer: All amcrest entries deleted = Everything seemed fine and the entry under Mosquitto broker MQTT is gone.
  5. HA (Host) restart: Entry for amcrest still available under Mosquitto broker MQTT.
  6. Try to delete the entry under Mosquitto broker MQTT Devices = Device/Service not found.

I repeated the process several times but the result was always the same.

So the addon is gone, all Amcrest AD110 entry in Mosquitto broker have been deleted, but after a HA restart the entry for amcrest reappears under Mosquitto broker MQTT. :frowning:

BTW: There are also no errors or problem messages in the log (core, MQTT …)

This is no longer a question about deleting MQTT entities but a problem with removing all vestiges of the amcrest2mqtt addon. I suggest you contact its author.

Did you check in here for more entries? Expand this “homeassistant”, check in sesnors or binary_sensors for any Amcrest entries and press the delete/trash button in mqtt explorer
415fbd1410276556f1e42428bc4191b1ba8c34ec

jim_os claims to have deleted all topics related to the Add-on:

So the addon is gone, all Amcrest AD110 entry in Mosquitto broker have been deleted, but after a HA restart the entry for amcrest reappears under Mosquitto broker MQTT

However, if jim_os didn’t delete the MQTT Discovery topics related to the Add-on then he either didn’t read or failed to understand the Solution post. It specifically explains the need to delete the related discovery topics published with the root topic homeassistant.

If they were automatically discovered, purge their MQTT Discovery topic. Use an MQTT client, like MQTT Explorer, to determine if there is a topic on your broker like homeassistant/sensor/name_of_your_sensor/config. If there is, use MQTT Explorer to delete it.

@123 probably but a couple of weeks ago I also had some mqtt issues and after some searches I found one of your posts which help solve the problem! And that was indeed what I suggested above.

Thanks for your reply. I was able to solve the problem in the meantime and it was exactly what you described. :slightly_smiling_face: I downloaded the MQTT diagnostic information and found

   },
    "device": {
      "id": "9daxxxxxxxxx",
      "name": "Amcrest AD110",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "device_class": null,
          "disabled_by": "integration",
          "disabled": true,
          "entity_category": "diagnostic",
          "entity_id": "sensor.ad110_version",
          "icon": null,
          "original_device_class": null,
          "original_icon": "mdi:package-up",
          "state": null,
          "unit_of_measurement": null
        },
        {
          "device_class": null,
          "disabled_by": "integration",
          "disabled": true,
          "entity_category": "diagnostic",
          "entity_id": "sensor.ad110_serial_number",
          "icon": null,
          "original_device_class": null,
          "original_icon": "mdi:alphabetical-variant",
          "state": null,
          "unit_of_measurement": null
        },
        {
          "device_class": null,
          "disabled_by": "integration",
          "disabled": true,
          "entity_category": "diagnostic",
          "entity_id": "sensor.ad110_host",
          "icon": null,
          "original_device_class": null,
          "original_icon": "mdi:ip-network",
          "state": null,
          "unit_of_measurement": null
        }
      ]

There are three hidden sensor entities
AD110

and HA says “The entity does not exist.”

AD110_Host

But these entries were still in the MQTT database. So these three entities were reloaded after a HA reboot. I deleted them from the MQTT database and the “spook” was over. :grinning:

So when you originally said:

You actually did not delete everything related to Amcrest.

Can you describe what you deleted specifically?

Yes I did not delete everything related to Amcrest AD110.

First I uninstalled the addon using the HA addon uninstall function. I thought that would uninstall the addon completely. But after a reboot the device was back under HA Mosquitto broker - MQTT.

Then I got to the MQTT-database with MQTT Explorer and I deleted the single amcrest2mqtt entry there. Then the entry under HA Mosquitto broker - MQTT → devices was completely gone, but after a HA Restart I saw Amcrest AD110 again under HA Mosquitto broker - MQTT.

I look at the MQTT database and found an/three entry under homeassistant → sensor with the device name Amcrest AD110. Previously I had only searched for amcrest2mqtt. After I deleted those entries, the problem is gone.

That’s exactly what is explained in the Solution post. You have to delete the discovery topics related to the device and discovery topics begin with homeassistant.