Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.35k stars 1.69k forks source link

Zigbee2mqtt keeps on loosing all devices networked coordinator - database.db is removed #19988

Open gorstj opened 1 year ago

gorstj commented 1 year ago

What happened?

Sporadically all my zigbee2mqtt devices disappear from HomeAssistant (sometimes related to a planned reboot, sometimes related to a zigbee2mqtt upgrade - but not consistently related to either)

Happens every 1-2 weeks.

Looking at the zigbee2mqtt GUI the device list is empty

If I restore config from 24-48 hours prior then all the devices re-appear (extract the zigbee2mqtt directory from HA backup and upload it)

What did you expect to happen?

For all my devices not to disappear

How to reproduce it (minimal and precise)

Sporadic issue

Zigbee2MQTT version

1.34.0

Adapter firmware version

6.7.9.0 build 405

Adapter

ZB-GW03 (networked)

Debug log

No debug logs available yet - will enable to catch when next happens.

Update - debug logs have been on but nothing in the HomeAssistant log or zigbee2mqtt add-on log (as it must have been wiped after I restarted the plugin with the backup). Will try and look in log next time it happens

Malaysk commented 1 year ago

This happens to me periodically too. This instability is very bad. This happens on sonoff zbbridge pro and sonoff zigbee bridge coordinators. All connected devices disappear and this happens periodically. Maybe everything works for a week, then within 2 days all devices disappear 2 times.

oywino commented 1 year ago

For what it's worth, my problem is somewhat similar, and I found that for some reason Z2M kills the database.db file sometimes (often) when MQTT or HA reboots causing all devices to disappear. I found a database.db.backup file that could be restored manually, so at least I didn't have to re-pair all devices over and over again every time. Not a real solution, but at least offloading some of the burden.

JackTalisker commented 12 months ago

I experience the same problem. Everytime I have to reboot for some reason my router, database.db is erased and the device list is empty.
To avoid this I have to stop z2m container, reboot my router and then restart my containers. This happens sometimes for other unknown reasons as well.

kauha commented 12 months ago

I have the same problem also. Did not happen before but keeps happening since last 2 weeks.

JackTalisker commented 12 months ago

I experience the same problem. Everytime I have to reboot for some reason my router, database.db is erased and the device list is empty. To avoid this I have to stop z2m container, reboot my router and then restart my containers. This happens sometimes for other unknown reasons as well.

I have a tasmotized ZBBridge rev. 6.7.9.0 build 405 as well. Can the other participants tell the coordinator type?

trebestie commented 12 months ago

I don't know if i'm suffering the same issue but... my system is based on some lxc containers each of them hosting a dockerized microservice. Few days ago, after updating home assistant, zigbee2mqtt and eclipse-mosquitto to the latest releases, I started loosing my devices. I had a little cron script which every night rebooted the z2m and mosquitto containers and the problem occurred (twice) randomly after three or four restarts. Only a full reboot of the home assistant container fixed it, a simple restart of the hass service was not enough. No more clues, container and services are up and running but they do not talk with each other. I suspect, without any kind of evidence, eclipse-mosquitto is the guilty. My coordinator is a Sonoff Hope this helps My regards

gorstj commented 12 months ago

I have just noted that database.db is removed

Is this because we are all using a network connected ZigBee co-ordinator?

dfuse-dev commented 12 months ago

Same here... also with Ethernet coordinator and LXC

mccasian commented 11 months ago

same here. Luckily I have the db backup + my daily backup on all docker containers, therefore z2m too. However, loosing the devices 1-2 times a month is not fun. If Z2M provides logs, someone tell me please what logs you need and I can provide them(next time when will happen). I am having a syslog-ng server too.

gorstj commented 11 months ago

Do you have a USB or network attached Zigbee co-ordinator?

most annoying for me is that the devices disappear from HomeAssistant and even when I restore the database.db I need to setup some automations and voice stuff in HA

mccasian commented 11 months ago

I have Sonoff ZbBridge(non-Pro) connected over WIFI. I am so sick of it(ZB Coordinator issues) that i'll go on Wednesday morning to Lidl to buy the Silvercrest ZbBridge, as that one is also compatible with Z2M and ZHA. This one: https://www.lidl.ch/p/de-CH/gateway/p341809 I never have to do any change on Home Assistant after restoring the db, but I have two Aquara Ambient sensors which have to be re-connected after that, while a third Aquara Ambient sensor does not need that.

maccoylton commented 10 months ago

Same issue with ZbBridge (non-Pro) restoring the db backup and restarting is the quickest way to get back up and running

mccasian commented 10 months ago

i gave up with the Sonoff ZbBridge. I've switched to the Moes/Lidl/Aldi/Silvercrest gateway which some people recommended.

The instructions are here: TuyaTYGWZ and here: Hacking the Silvercrest.

This one works different, it's not using tasmota -> linux does the job here. It can be found as LAN+ZB(all of them) or Wifi+ZB(only Moes on Aliexpress). I totally recommend the LAN variant for stability. This bridge is running Linux, and the hacking means to get the root password for linux, then flash the ZB Chip with the same coordinator firmware like for Sonoff Bridges. After flashing the ZB Chip, the ZBBridge will listen on port 8888 exactly like the ones with Tasmota are doing.

Before buying it I was not sure how will LAN port be useful since Tasmota is not LAN ready. The answer is simple... you keep the linux as it is, so you don't have to install Tasmota. It works with HA Z2m and ZHA just like the other ones.

3 days already, and i didn't had even the smallest glitch yet. Everything is perfect.

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days

Na0mir commented 3 months ago

Don't close it bot, bug still there.

Affected by this bug too using a network coordinator

HarmK2 commented 1 week ago

This helped me a lot. Lost all devices in the GUI as well, but not in HASS itself. Removed icon data of every device from config.yaml in the zigbee2mqtt directory and all devices showed up again!!.