Zigbee2mqtt stops working after a while

Hi,

I am using the regular zigbee2mqtt addon in hassio and I successfully made everything work with my cc2531 as coordinator, a few sensors, bulb etc.

…until it doesn’t. It seems that it just “stops” sending/receiving any data. I can still see the dashboard, I can even “Load map”, but it only shows all previously connected devices without any Link in between. Some devices just show “NA” in “Last seen” or no LQI indicator (some show 0, others some random number like 170).

I haven’t found anything suspicious in the logs of the zigbee2mqtt addon, nor the ZHA, nor the home assistant itself.

This is how it looks like. You can see “no update” (flat line) until about 11pm one day, then I rebooted the host, then it started to pick up new data, then it stops again two days after at 4pm. :frowning: This is the same for all devices, this is just an example.

When I restart the addon, I can see in my mosquito broker that the client gets disconnected, but it’s not reconnected again. So I checked the logs and found:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] socat.sh: executing... 
[11:55:02] INFO: Socat not enabled, marking service as down
[cont-init.d] socat.sh: exited 0.
[cont-init.d] zigbee2mqtt.sh: executing... 
[11:55:03] INFO: MQTT available, fetching server detail ...
[11:55:03] INFO: Previous config file found, checking backup
[11:55:03] INFO: Creating backup config in '/config/zigbee2mqtt/.configuration.yaml.bk'
[11:55:04] INFO: Adjusting Zigbee2mqtt core yaml config with add-on quirks ...
[cont-init.d] zigbee2mqtt.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[11:55:05] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start /app
> node index.js
Zigbee2MQTT:error 2021-05-01 11:55:57: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2021-05-01 11:55:57: Failed to start zigbee
Zigbee2MQTT:error 2021-05-01 11:55:57: Check https://www.zigbee2mqtt.io/information/FAQ.html#help-zigbee2mqtt-fails-to-start for possible solutions
Zigbee2MQTT:error 2021-05-01 11:55:57: Exiting...
Zigbee2MQTT:error 2021-05-01 11:55:57: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.<anonymous> (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:94:31)
    at Generator.throw (<anonymous>)
    at rejected (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:25:65)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-05-01T09_56_33_574Z-debug.log
[11:56:34] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start /app
> node index.js
Zigbee2MQTT:error 2021-05-01 11:57:21: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2021-05-01 11:57:21: Failed to start zigbee
Zigbee2MQTT:error 2021-05-01 11:57:21: Check https://www.zigbee2mqtt.io/information/FAQ.html#help-zigbee2mqtt-fails-to-start for possible solutions
Zigbee2MQTT:error 2021-05-01 11:57:21: Exiting...
Zigbee2MQTT:error 2021-05-01 11:57:21: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.<anonymous> (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:94:31)
    at Generator.throw (<anonymous>)
    at rejected (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:25:65)

so it seems like that the host lost connection to the adapter for some reason? But the RPi with the adapter is still exactly at the same position without anyone touching it. Could it be some weird USB glitch? When I restart the host, it picks up the coordinator fine, but it also shows weird values of LQI (such as all devices either 1 or 170), and values are not updating. But sometimes it does help.

Here is when I switched on the debug log mode.

Anyone experiencing the same stuff? Thanks for the help!

I have this happen as well. Is yours a seperate docker container? Mine is, and usefully not on the same machine as anything else.

The only solution I find that regularly works is a reboot. It’s something to do with the usb not being released

I am using Home Assistant Operating System variant so the addon runs in a separate docker container under the hood.

Having to manually restart the host every day to make things work sounds like nightmare, this should handle e.g. HVAC and stuff, so not updating for e.g. 8 hours during the sleep (+ annoyance factor having to check it) sounds like total nightmare :sob: .

Furthmore, rebooting the host doesn’t seem to solve it every time (I just tried twice, and it doesn’t throw an error at least, but it also simply doesn’t work - just silently doesn’t do anything like updating sensor data and stuff).

Do you use an usb extension cable ? Or is the CC2531 plugged straight in the RbPi ?

It’s straight in the RPi with an external antenna connected to it. This one

Try to use an extension cable.

1 Like

OK, will do and report what happens, thanks.

Btw. some related links:

Just to note, according to the logs you posted, you don’t have a running CC2531. It doesn’t get connected from the beginning…

Thanks, that was only once, when I restarted it all again, it does start fine. It’s unfortunately quite inconsistent :frowning: .

Hey. So after using USB extender, it really works as expected.

Interestingly, using the antenna doesn’t improve the LQI of any device at all (at least according to LQI metrics in homeassistant). I am quite disappointed about it :man_shrugging: . My conclusion therefore is, that the USB extender is much more important than an external antenna…

This solved it.