ZigBee not available at startup / BT unavailable

Hello/Good evening,
I have a small issue I’ve recently encountered that I’d like to submit to you.
On startup of the Pi, the ZigBee module does not start. I have to activate it manually.
In the logs, I found this just after startup:

\u003cwarn\u003e init.js:41 (Zigbee2mqttManager.init) Zigbee2mqtt USB dongle detached to /dev/ttyUSB0

Why? How can this be resolved?
At the same time, I discovered this but I had already given up using my Bluetooth tag because it was too unstable…

2022-12-11T20:27:44+0100 \u003cinfo\u003e index.js:15 (Object.start) Starting Bluetooth service
2022-12-11T20:27:44+0100 \u003cwarn\u003e service.start.js:44 (Service.start) Unable to start service bluetooth Error: Cannot find module '@abandonware/bluetooth-hci-socket'
Require stack:
- /src/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js
- /src/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js
- /src/server/services/bluetooth/node_modules/@abandonware/noble/lib/resolve-bindings.js
- /src/server/services/bluetooth/node_modules/@abandonware/noble/index.js
- /src/server/services/bluetooth/lib/commands/bluetooth.start.js
- /src/server/services/bluetooth/lib/index.js
- /src/server/services/bluetooth/index.js
- /src/server/services/index.js
- /src/server/lib/index.js
- /src/server/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.\u003canonymous\u003e (/src/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:6:28)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.\u003canonymous\u003e (/src/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:7:13)    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at module.exports (/src/server/services/bluetooth/node_modules/@abandonware/noble/lib/resolve-bindings.js:13:12)
    at Object.\u003canonymous\u003e (/src/server/services/bluetooth/node_modules/@abandonware/noble/index.js:2:49)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at BluetoothManager.start (/src/server/services/bluetooth/lib/commands/bluetooth.start.js:16:20)
    at Object.start (/src/server/services/bluetooth/index.js:16:28)
    at Service.start (/src/server/lib/service/service.start.js:33:21) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/src/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js',
    '/src/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js',
    '/src/server/services/bluetooth/node_modules/@abandonware/noble/lib/resolve-bindings.js',
    '/src/server/services/bluetooth/node_modules/@abandonware/noble/index.js',
    '/src/server/services/bluetooth/lib/commands/bluetooth.start.js',
    '/src/server/services/bluetooth/lib/index.js',
    '/src/server/services/bluetooth/index.js',
    '/src/server/services/index.js',
    '/src/server/lib/index.js',
    '/src/server/index.js'
  ]
}

The bluetooth service is therefore reported as ‹ in error ›
Thank you for your help

Ah, uh, about the BT, I just saw it was already reported… Sorry for the duplicate.

According to the integration code, that means the USB port you declared in Zigbee2mqtt is not available (when listing ports):

The code:

Could it be that your USB port changed after the reboot?

No worries, we’re on it! :smiley:

hello
I just reinstalled Gladys, everything seems to be working except Z2M, which started but has still been showing the red cross since 4 PM this afternoon — no change

For your information, I carried out a complete investigation on a fresh installation.

I installed a Raspberry Pi 3 B+ using the Raspberry Pi OS 64-bit image (starting from scratch)

USB scan without issues:

Connection without problems:

Zigbee is functional:

I ran a docker restart gladys, and Zigbee remained functional:

2022-12-13T08:00:01+0100 \u003cinfo\u003e init.js:38 (Zigbee2mqttManager.init) Zigbee2mqtt USB dongle attached to /dev/ttyUSB0
2022-12-13T08:00:01+0100 \u003cinfo\u003e installMqttContainer.js:104 (Zigbee2mqttManager.installMqttContainer) MQTT broker container successfully started
2022-12-13T08:00:02+0100 \u003cinfo\u003e installZ2mContainer.js:56 (Zigbee2mqttManager.installZ2mContainer) Preparing Zigbee2mqtt environment...
2022-12-13T08:00:02+0100 \u003cinfo\u003e installZ2mContainer.js:75 (Zigbee2mqttManager.installZ2mContainer) Zigbee2mqtt container successfully started
2022-12-13T08:00:02+0100 \u003cinfo\u003e connect.js:14 (Zigbee2mqttManager.connect) Connecting Gladys to mqtt://localhost:1884 MQTT broker...
2022-12-13T08:00:02+0100 \u003cinfo\u003e connect.js:24 (MqttClient.\u003canonymous\u003e) Connected to MQTT container mqtt://localhost:1884
2022-12-13T08:00:02+0100 \u003cinfo\u003e subscribe.js:12 (Zigbee2mqttManager.subscribe) Subscribing to MQTT topic zigbee2mqtt/#

MQTT installation without issue:

Then

docker restart gladys

And Z2M + MQTT still functional:

I think there is an issue specific to your installations, but in any case the recent update does not break either MQTT or Zigbee2mqtt…

I’d appreciate more information so I can help you :slight_smile:

1 Like

So, I found it!
I moved the dongle to a different USB port. And I don’t have the problem anymore…
To be precise, I realized it had been happening since I changed my setup on the RPi. I replaced two USB drives with a single one…
I probably hadn’t plugged the dongle back into the same port, but why would that be a problem? Shouldn’t that be saved from one time to the next?
Thanks anyway @pierre-gilles for the thorough test and the time spent!

1 Like

Good that you found it!

That’s a problem because Zigbee2mqtt remembers the USB port :smiley: So if you change the port, it won’t find the dongle anymore ^^

The problem is mainly that the USB library doesn’t handle udev rules, so you can’t set the port.

But if I click ‹ Save configuration ›, isn’t it supposed to update the port and keep it for the next reboot?

Yes but it’s annoying, the whole point of udev rules is to say « my Sonoff dongle will always be on /dev/tty-zigbee » no matter the USB port. But the usb-serial library doesn’t list them. :neutral_face:

1 Like

Ok, I got it…
Next time I touch the USB ports, I’ll stick colored dots on them first :smiley:
Have a great evening/day!

2 Likes

hello, I just tested with MQTT Explorer — apparently I can see the key and it’s communicating, so the problem is elsewhere on the Gladys side, but what

That’s not Zigbee, that’s plain MQTT/ Tasmota

Ah darn, so still no Zigbee yet.

As already mentioned in another post, your problem is either with your key or with your power supply.
Have you checked these two points?

well I don’t know anymore, I did manage to flash the dongle, but that doesn’t mean it works, I tried all the other methods
I think I’m going to try a full reinstall which I’ve already done, but I hadn’t formatted the disk before — I was content to write the Gladys image and reconfigure everything. Is it possible that there are old config traces left?

otherwise my Zigbee dongle no longer heats up; before it warmed up a little as a sign that it was working, but now it stays cold

You can always try but I’d be surprised if that changes anything.

I don’t know how well you speak English, but if I were you I’d look quite a bit toward the Zigbee2mqtt community — it’s a fairly common bug with many different causes (sometimes power supply, sometimes a faulty dongle, sometimes a bug in the dongle’s firmware, sometimes an OS issue, etc…)

For example, searching for the bug on their forum there are a bunch of discussions: