zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Remove device but data stil there

Open phoxy84 opened this issue 7 years ago β€’ 14 comments

I can remove a device using the mqtt topic, but the device is still in my Hassio device list. Hoe can I completely remove the device so Hassio won’t see it anymore?

phoxy84 avatar Jan 10 '19 18:01 phoxy84

remove it from configuration.yaml, database.db and state.json in the /data folder of zigbee2mqtt.

Search those for the device address, and remove all mentions, then restart zigbee2mqtt.

henriz avatar Jan 12 '19 13:01 henriz

I tried all. Now I removed the sniffer, uninstalled the addon, removed the folder, etc., but the entity_id's are still showing up in Hassio, they are grey but still showing up. They are not there when mqtt discovery is false in Hassio config yaml. Any ideas?

phoxy84 avatar Jan 28 '19 19:01 phoxy84

Entity id's are not stored by Zigbee2mqtt but by homeassistant. You'll need to remove them manually from the '.storage' folder.

Landrash avatar Jan 28 '19 20:01 Landrash

Can you tell me how?

phoxy84 avatar Jan 28 '19 21:01 phoxy84

@phoxy84 update to home assistant to 0.87 , then Configuration > Entity Registry > select the entry > delete

This release also includes a UI to manage the entity registry. The entity registry contains all entities with unique IDs that Home Assistant has ever seen. It will allow users to quickly rename entities, change entity IDs or have Home Assistant forget entities that are no longer active. https://www.home-assistant.io/blog/2019/02/06/release-87/

Pockrandt avatar Feb 09 '19 12:02 Pockrandt

@phoxy84 update to home assistant to 0.87 , then Configuration > Entity Registry > select the entry > delete

This release also includes a UI to manage the entity registry. The entity registry contains all entities with unique IDs that Home Assistant has ever seen. It will allow users to quickly rename entities, change entity IDs or have Home Assistant forget entities that are no longer active. https://www.home-assistant.io/blog/2019/02/06/release-87/

Indeed, I removed them now.

phoxy84 avatar Feb 09 '19 13:02 phoxy84

who ever might find this post:

This is the full ~~guide~~ story what is did to remove my aqara body sensor (probably overkill)

  1. find the device ID from Configuration> Integrations > MQTT: configuration.yaml

  2. remove devices from Configuration Entity Registry

  3. ssh into home assistant > stop home assistant hassio ha stop

  4. remove device from bridge mosquitto_pub -h IP -p PORT -u USER -P PW -t "zigbee2mqtt/bridge/config/remove" -m "0x00158d000123a45b"

  5. (A) clean mqtt listen to all to find correct topic format mosquitto_sub -h IP -p PORT -u USER -P PW -v -d -R -t '#' remove cfg

mosquitto_pub -h IP -p PORT -u USER -P PW -r -n -t "homeassistant/binary_sensor/0x00158d000123a45b/occupancy/config"
mosquitto_pub -h IP -p PORT -u USER -P PW -r -n -t "homeassistant/binary_sensor/0x00158d000123a45b/illuminance/config"
mosquitto_pub -h IP -p PORT -u USER -P PW -r -n -t "homeassistant/binary_sensor/0x00158d000123a45b/battery/config"
mosquitto_pub -h IP -p PORT -u USER -P PW -r -n -t "homeassistant/binary_sensor/0x00158d000123a45b/config"
  1. (B) or reinstall Mosquitto addon (save your config and stop zigbee2mqtt prior and do it before stopping home assistant ;) )

  2. remove device from .storage/core.device_registry

  3. start home assistant hassio ha start

Pockrandt avatar Feb 09 '19 14:02 Pockrandt

@Pockrandt thanks for these instructions!

Koenkk avatar Feb 09 '19 16:02 Koenkk

Pockrandt (B) or reinstall Mosquitto addon (save your config and stop zigbee2mqtt prior and do it before stopping home assistant ;) )

Solved

  1. instead of reinstalling mosquitto: stop HA, stop Mosquitto, stop zigbee2mqtt.
  2. Remove /var/lib/mosquitto/mosquitto.db (lot of rubbish inside)
  3. start mosquitto

then

  1. started HA and check Entity Registry in Configuration
  2. verify no entry from zigbee2mqtt (also the non-desiderable) are available
  3. start Zigbee2mqtt
  4. wait 2 minutes to let Z2M republish all the entities
  5. restart HA to refresh the Entity Registry

Verify all the non-desiderable enities vainshed like magic

gericho avatar Aug 04 '19 22:08 gericho

Pockrandt (B) or reinstall Mosquitto addon (save your config and stop zigbee2mqtt prior and do it before stopping home assistant ;) )

Solved

  1. instead of reinstalling mosquitto: stop HA, stop Mosquitto, stop zigbee2mqtt.
  2. Remove /var/lib/mosquitto/mosquitto.db (lot of rubbish inside)
  3. start mosquitto

then

  1. started HA and check Entity Registry in Configuration
  2. verify no entry from zigbee2mqtt (also the non-desiderable) are available
  3. start Zigbee2mqtt
  4. wait 2 minutes to let Z2M republish all the entities
  5. restart HA to refresh the Entity Registry

Verify all the non-desiderable enities vainshed like magic

could you share wich system you are using? With hassio i checked the /var/lib folder... but no luck finding Mosquitto files

(i am using the ssh add-on) not getting the debug ssh thing to work..

will try some other stuff to get rid of those damn entities...

MrMennens avatar Aug 10 '19 21:08 MrMennens

Sure, since I don't like hass.io cause the CPU overhead, I have a Debian install, with only HA as one python venv. I think you have to look in the file system inside the MQTT docker image and not in the root file system.

gericho avatar Aug 10 '19 21:08 gericho

Yeah.. thought this was the case...

just got one old zigbee device working again... checking the zigbee2mqtt dev to see if my new devices work

MrMennens avatar Aug 10 '19 21:08 MrMennens

How I removed the device from Domoticz. First of all, I deleted the device in "Setup" - "Devices". Next in console: # systemctl stop domoticz.service # systemctl stop zigbee2mqtt.service # mosquitto_pub -h IP -p PORT -u USER -P PW -t "zigbee2mqtt/bridge/config/remove" -m "0x00158d000123a45b"

anshgh avatar Aug 26 '19 07:08 anshgh

who ever might find this post:

This is the full ~guide~ story what is did to remove my aqara body sensor (probably overkill)

  1. find the device ID from Configuration> Integrations > MQTT: configuration.yaml
  2. remove devices from Configuration Entity Registry
  3. ssh into home assistant > stop home assistant hassio ha stop
  4. remove device from bridge mosquitto_pub -h IP -p PORT -u USER -P PW -t "zigbee2mqtt/bridge/config/remove" -m "0x00158d000123a45b"
  5. (A) clean mqtt listen to all to find correct topic format mosquitto_sub -h IP -p PORT -u USER -P PW -v -d -R -t '#' remove cfg
mosquitto_pub -h IP -p PORT -u USER -P PW -r -n -t "homeassistant/binary_sensor/0x00158d000123a45b/occupancy/config"
mosquitto_pub -h IP -p PORT -u USER -P PW -r -n -t "homeassistant/binary_sensor/0x00158d000123a45b/illuminance/config"
mosquitto_pub -h IP -p PORT -u USER -P PW -r -n -t "homeassistant/binary_sensor/0x00158d000123a45b/battery/config"
mosquitto_pub -h IP -p PORT -u USER -P PW -r -n -t "homeassistant/binary_sensor/0x00158d000123a45b/config"
  1. (B) or reinstall Mosquitto addon (save your config and stop zigbee2mqtt prior and do it before stopping home assistant ;) )
  2. remove device from .storage/core.device_registry
  3. start home assistant hassio ha start

Thank you so much. This guide should be in the official documentation.

thachnb85 avatar Nov 14 '19 12:11 thachnb85