# ZigBee not available at startup / BT unavailable

**URL:** <https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754>\
**Category:** Configuration\
**Created:** [December 11, 2022, 8:35pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754 "2022-12-11T20:35:07Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![GBoulvin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/gboulvin/32/10006_2.png) [@GBoulvin](https://community.gladysassistant.com/u/GBoulvin)\
**Post date:** [December 11, 2022, 8:35pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/1 "2022-12-11T20:35:07Z")

</div>

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:

```auto
\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…

```auto
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 ‹&nbsp;in error&nbsp;›  
Thank you for your help

---

<div class="post-metadata">

**Author:** ![GBoulvin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/gboulvin/32/10006_2.png) [@GBoulvin](https://community.gladysassistant.com/u/GBoulvin)\
**Post date:** [December 11, 2022, 8:59pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/2 "2022-12-11T20:59:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [December 12, 2022, 4:01am UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/3 "2022-12-12T04:01:41Z")

</div>

> [@GBoulvin](#):
>
> On boot of the Pi, the ZigBee module doesn’t start. I have to enable it manually.  
> In the logs, I found this just after startup:

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

The code:

> <https://github.com/GladysAssistant/Gladys/blob/fbef01e5193a44a63074cc00bd5cd9fc64b01e09/server/services/zigbee2mqtt/lib/init.js#L34>

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

> [@GBoulvin](#):
>
> Ah uh for Bluetooth, I just saw that it had already been reported… Sorry for the duplicate.

No worries, we’re on it! 😃

---

<div class="post-metadata">

**Author:** ![pascal\_sapin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pascal_sapin/32/8958_2.png) [@pascal\_sapin](https://community.gladysassistant.com/u/pascal_sapin)\
**Post date:** [December 12, 2022, 4:11pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/5 "2022-12-12T16:11:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [December 13, 2022, 1:26pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/6 "2022-12-13T13:26:10Z")

</div>

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:

 ![Screenshot 2022-12-13 at 13.55.06](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/d/d90e11d46a2e97f30a236b97258a4d2a375711c6.png)

Connection without problems:

 ![Screenshot 2022-12-13 at 14.02.55](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/a/af4b002635db4f4fc43348b7445bc98bdc66bb11.png)

Zigbee is functional:

 ![Screenshot 2022-12-13 at 14.04.15](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/2/27029d370b54bb2e9334e17ca13e925e481d2811.png)

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

```auto
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:

 ![Screenshot 2022-12-13 at 14.05.43](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/c/ccebcb17d7c6d8a40714b4aa01bc304e6ec2cca7.png)

Then

```auto
docker restart gladys

```

And Z2M + MQTT still functional:

 ![Screenshot 2022-12-13 at 14.07.13](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/b/b1f1d875e73bb3aa120c225a276baad9d20f8663.png)

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 🙂

---

<div class="post-metadata">

**Author:** ![GBoulvin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/gboulvin/32/10006_2.png) [@GBoulvin](https://community.gladysassistant.com/u/GBoulvin)\
**Post date:** [December 13, 2022, 7:07pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/7 "2022-12-13T19:07:30Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [December 14, 2022, 2:31am UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/8 "2022-12-14T02:31:26Z")

</div>

Good that you found it!

> [@GBoulvin](#):
>
> To be precise, I realized that it had been happening since I changed my config on the RPi. I replaced two USB drives with a single one…  
> I probably hadn’t reconnected the dongle to the same port, but how would that be a problem?

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

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [December 14, 2022, 8:04am UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/9 "2022-12-14T08:04:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GBoulvin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/gboulvin/32/10006_2.png) [@GBoulvin](https://community.gladysassistant.com/u/GBoulvin)\
**Post date:** [December 14, 2022, 2:15pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/10 "2022-12-14T14:15:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [December 14, 2022, 4:54pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/11 "2022-12-14T16:54:41Z")

</div>

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

> <https://github.com/serialport/node-serialport/issues/1476>
>
> \- Debian Jessie on Raspberry PI2
> Hi,
> 
> since with every reboot of raspbian (be…live it is the same with other UNIX systems) the USB port assignments are jepardized if several serial devices are attached. Like /dev/ttyUSB0 can be /dev/ttyUSB1
> at next boot. It would be good to have the possilbity to list devices by device id path for example:
> /dev/serial/by-id/usb-FTDI\_FT232R\_USB\_UART\_A50285BI-if00-port0
> or also list symlinks. Then a static link can be created via /etc/udev/rules.d
> 
> This is what I have:
> 
> \> pi@rpi:~ $ ls -l /dev/ttyUSB1
> \> crw-rw---- 1 root dialout 188, 1 Feb 6 10:47 /dev/ttyUSB1
> \> pi@rpi:~ $ ls -l /dev/ttyRflink
> \> lrwxrwxrwx 1 root root 7 Feb 6 10:44 /dev/ttyRflink -\> ttyUSB1
> 
> But /dev/ttyRflink does not get listed by serialport.js

---

<div class="post-metadata">

**Author:** ![GBoulvin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/gboulvin/32/10006_2.png) [@GBoulvin](https://community.gladysassistant.com/u/GBoulvin)\
**Post date:** [December 14, 2022, 6:44pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/12 "2022-12-14T18:44:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pascal\_sapin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pascal_sapin/32/8958_2.png) [@pascal\_sapin](https://community.gladysassistant.com/u/pascal_sapin)\
**Post date:** [December 16, 2022, 9:59am UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/13 "2022-12-16T09:59:16Z")

</div>

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

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/a/ac4374a1842c4c01170b05506b60ce583a670676.png)

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [December 16, 2022, 10:05am UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/14 "2022-12-16T10:05:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pascal\_sapin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pascal_sapin/32/8958_2.png) [@pascal\_sapin](https://community.gladysassistant.com/u/pascal_sapin)\
**Post date:** [December 16, 2022, 10:53am UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/15 "2022-12-16T10:53:11Z")

</div>

Ah darn, so still no Zigbee yet.

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [December 16, 2022, 3:58pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/16 "2022-12-16T15:58:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pascal\_sapin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pascal_sapin/32/8958_2.png) [@pascal\_sapin](https://community.gladysassistant.com/u/pascal_sapin)\
**Post date:** [December 18, 2022, 10:45am UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/17 "2022-12-18T10:45:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [December 19, 2022, 1:52pm UTC](https://community.gladysassistant.com/t/zigbee-non-disponible-au-demarrage-bt-indisponible/7754/18 "2022-12-19T13:52:54Z")

</div>

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:

> **[Koenkk zigbee2mqtt · Discussions](https://github.com/Koenkk/zigbee2mqtt/discussions?discussions_q=SYS%2Bping%2Bafter%2B6000ms%2B)**
>
> Explore the GitHub Discussions forum for Koenkk zigbee2mqtt. Discuss code, ask questions & collaborate with the developer community.
