Zigbee2mqtt: getting rid of your proprietary Zigbee bridges (Xiaomi, Hue, TRADFRI)

Did you check in /opt/zigbee2mqtt/data/configuration.yaml that the device is gone from there as well?

1 Like

I’m on hassio and using the addon. I checked the one at \\HASSIO\share\zigbee2mqtt\configuration.yaml. And it is not in it. Is that the correct path for me?

Unfortunately, I am not too familiar with hassio but it sounds right.

Dumb debugging question: if you disable zigbee2mqtt, then restart HA, are you still seeing the device?

1 Like

Just gave it a try. Stopped zigbee2mqtt and told it not to start on boot. The sensors are still there (both temperature and motion) but like all the other zigbee2mqtt sensors it says unavailable until I started zigbee2mqtt back up.

Apparently its an HA issue, but I’m not sure where to delete it. I haven’t created any entries in any yaml modules referencing this sensor. Is there a database somewhere that stores the entities? Any point in deleting home-assistant_v2.db?

I am really spitballing here but…

Have you checked know_devices.yaml?

You could also see if removing states helps:

sqlite3 home-assistant_v2.db
delete from states where entity_id='{your entity id}';
.q

You could list entity ids first if you are unsure what its name is:

sqlite3 home-assistant_v2.db
select distinct(entity_id) from states;
1 Like

Just checked known_devices.yaml. Not there. Regarding the db, I already deleted all records and executed Vacuum. After reboot still there.

I was reading the link below, and if I’m reading it correctly, it says if I’m using Discovery for MQTT in configuration.yaml (which I am) then I have to publish a null payload to a config topic to remove old mqtt sensors. However I’m not getting very far with that. I tried to publish a null to the topic of zigbee2mqtt/bridge/config/devices but haven’t rebooted yet . I’m over my head.

Edit: I rebooted after publishing an empty payload to the topic zigbee2mqtt/bridge/config/devices, and sensors still there. Ugggh.

try publishing a null to the same topic that the actual sensor published to. Also make sure you publish with the retain flag set to true.

I don’t remember what the command line way is to do that. I use MQTT.Fx and it’s pretty easy using that.

1 Like

Thanks for the reply. So it looks like the topic that the actual sensors publish to when they are triggered is zigbee2mqtt/sensorname, so in this case:

zigbee2mqtt/0x000d6f001099e666

I use Node Red, and chose Retain: true. Published a null to the topic above, removed the 0x000d6f001099e666 entries from the device and entity registries and rebooted. Unfortunately they’re back.

I’m grasping here but try turning off discovery for a bit and do all of the above again to see if they come back. Of they do it’s likely a HA issue. If they don’t it’s probably in Z2M. At least it will be another point of info to try to narrow things down.

1 Like

I don’t see my entry where I published a null in the zigbee2mqtt log. I tried using both Node Red and also Home Assistant’s MQTT Publish a Packet under Dev Tools. Will try your suggestion to turn off Discovery and try to find another way to publish a null.

Edit: Now that I think about it, maybe when I publish to that topic, it shouldn’t show up in the zigbee2mqtt log?

  1. Stop HA
  2. Remove devices from entity registry
  3. Publish mqtt messages with empty payload to state and config topics of each device with retain flag set.
  4. Start HA

Hope this works.

Sorry for my lack of knowledge here:
The entity name is 0x000d6f001099e666. Publish an empty payload to zigbee2mqtt/0x000d6f001099e666/state and zigbee2mqtt/0x000d6f001099e666/config?

It is the discovery topic you need to send the null message to.

I am not at the computer right now, but it looks correct. You can see these messages at the very beginning of zigbee2mqtt log if logging level is set to info at least.

The harsh way: stop mqtt, delete the mosquitto database and start mqtt.

May be the only way as I cannot find the elusive topic to publish a null to. I’m on Hassio. Mosquito Broker addon config says there is a mosquitto folder. Mosquitto log says: 1545933123: Saving in-memory database to /data/mosquitto.db.

I can’t seem to find this database so I can delete it. I ssh using root credentials, and browsed through the folders looking using “ls” Doesn’t seem to be anything in the /data folder unless it’s hidden somehow. Also browsed the Samba share looking. Any tips on finding this database so I can delete it? Obviously I’m a little over my head.

Edit:
Tried find . -name "mosquitto.db" and it found nothing.

This is how I do it.

1 Copy the mqtt configuration in the web gui of hass.io
2 Uninstall mqtt add-on
3 Reinstal mqtt add-on
4 Paste back the config info into the web gui
5 Click save config changes
6 Restart the mqtt plugin

This will kill all the old retained topics and sensors.

Zigbee2mqtt will repopulate all the existing sensors when you restart the zigbee2mqtt add-on

2 Likes

Jesus that is a bit steep, destroying your database to get rid of one entry.

1 Like

Database ain’t important for mqtt all my sonoffs don’t use retained tag so it’s only zigbee2mqtt and that repopulates on restart.

1 Like

From start to finish, took less than 2 minutes. Finally got rid of the damned thing. Thanks. All the other sensors came back in quickly.

@nickrout Yeah I tried every topic that was suggested to publish a null to without success. Would still love to find that topic for future reference.