Issue with bluetooth stick

I am using a bluetooth stick (Avantree DG40S USB Bluetooth 4.0 Dongle) on my home server to get sensor data from two Xiamo devices.

  • MiFlora
  • Bluetooth Temperature and Humidity Sensor

I am using a docker container from https://github.com/aqualx/miflora-mqtt-daemon on a Debian server.

It works god, but sometimes I need to reset the bluetooth stick, because the container cannot connect to the devices.

This is in my syslog:

Aug 28 02:08:42 magneto kernel: [2696650.197050] bluepy-helper[15802]: segfault at 562f0000000b ip 00007f2838012248 sp 00007ffd96bb9560 error 4 in libc-2.24.so[7f2837f9b000+195000]
Aug 28 03:13:50 magneto kernel: [2700558.144245] bluepy-helper[23351]: segfault at 55700000000b ip 00007f0147184248 sp 00007ffdaa277330 error 4 in libc-2.24.so[7f014710d000+195000]
Aug 28 08:07:21 magneto kernel: [2718168.871008] bluepy-helper[11402]: segfault at 560a0000000b ip 00007f3cfffba248 sp 00007ffc0b0887a0 error 4 in libc-2.24.so[7f3cfff43000+195000]
Aug 28 09:40:31 magneto kernel: [2723758.766665] Bluetooth: hci0: command 0x200e tx timeout
Aug 28 09:41:05 magneto kernel: [2723792.554476] Bluetooth: hci0: command 0x200e tx timeout
Aug 28 09:41:46 magneto kernel: [2723833.514498] Bluetooth: hci0: command 0x200e tx timeout
Aug 28 09:42:26 magneto kernel: [2723874.474496] Bluetooth: hci0: command 0x200e tx timeout
Aug 28 09:43:07 magneto kernel: [2723915.434487] Bluetooth: hci0: command 0x200e tx timeout
Aug 28 09:43:48 magneto kernel: [2723956.394479] Bluetooth: hci0: command 0x200e tx timeout
Aug 28 09:44:29 magneto kernel: [2723997.354569] Bluetooth: hci0: command 0x200e tx timeout
Aug 28 09:50:09 magneto kernel: [2724337.476682] Bluetooth: unknown link type 15
Aug 28 09:50:11 magneto kernel: [2724339.498507] Bluetooth: hci0: command 0x040a tx timeout
Aug 28 09:50:52 magneto kernel: [2724380.330317] Bluetooth: hci0: command 0x200e tx timeout

The container shows this:

[2019-08-28 19:01:13] Retrieving data from Mi Flora sensor "Anthurium" ...
[2019-08-28 19:03:17] Retrying ...
[2019-08-28 19:05:20] Failed to retrieve data from Mi Flora sensor "Anthurium" (C4:7C:8D:65:C0:3A), success rate: 86%

[2019-08-28 19:05:20] Sleeping for Mi Flora (300 seconds) ...

[2019-08-28 19:05:23] Retrieving data from Mijia Bluetooth Temperature Smart Humidity sensor "Flur" ...
[2019-08-28 19:07:27] Retrying ...
[2019-08-28 19:09:30] Failed to retrieve data from Mijia Bluetooth Temperature Smart Humidity sensor "Flur" (58:2D:34:35:30:F0), success rate: 87%

[2019-08-28 19:09:30] Sleeping for Mijia Bluetooth Temperature Smart Humidity (300 seconds) ...

Executing this command fixes the issue temporarely (some hours; a day, …).

sudo hciconfig hci0 reset

Before I create a work around where openhab resets the bluetooth dongle wehen there is now update from the sensor, I would like to solve this by preventing the dongle from failing in the first place.

Any idea what I can do?