# Bluetooth pada i już nie wstaje

**URL:** <https://forum.arturhome.pl/t/bluetooth-pada-i-juz-nie-wstaje/5919>\
**Category:** Sprzęt hosta dla HA\
**Created:** [14 Lipiec 2022 07:21 UTC](https://forum.arturhome.pl/t/bluetooth-pada-i-juz-nie-wstaje/5919 "2022-07-14T07:21:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Autor:** ![Foxeu](https://forum.arturhome.pl/user_avatar/forum.arturhome.pl/foxeu/32/8559_2.png) [@Foxeu](https://forum.arturhome.pl/u/Foxeu)\
**Data wpisu:** [14 Lipiec 2022 07:21 UTC](https://forum.arturhome.pl/t/bluetooth-pada-i-juz-nie-wstaje/5919/1 "2022-07-14T07:21:40Z")

</div>

To na czym jadę:  
Ubuntu 20.04  
HA Core  
Bluetooth Dongle 5.1 wątłej chińskiej firmy + podłączony na krótkim kablu a nie wsadzony bezpośrednio do usb w serwerku

Logi z Ubuntu:

```auto
lip 14 03:46:38 ubuntu kernel: usb 2-1.3.4: reset full-speed USB device number 100 using ehci-pci
lip 14 03:46:38 ubuntu upowerd[1859]: treating change event as add on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.4
lip 14 03:46:38 ubuntu upowerd[1859]: treating change event as add on /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.4
lip 14 03:46:39 ubuntu kernel: Bluetooth: hci0: command 0x2042 tx timeout
lip 14 03:46:41 ubuntu kernel: Bluetooth: hci0: command 0x1002 tx timeout
lip 14 03:46:42 ubuntu hass[80175]: 2022-07-14 03:46:42 ERROR (Thread-3) [custom_components.ble_monitor] HCIdump thread: Something wrong - interface hci0 not ready, and will be skipped for current scan period.
lip 14 03:46:43 ubuntu hass[80175]: 2022-07-14 03:46:42 ERROR (Thread-3) [custom_components.ble_monitor] HCIdump thread: Trying to power cycle Bluetooth adapter hci0 A0:A2:1B:5R:22:31, will try to use it next scan period.
lip 14 03:46:44 ubuntu kernel: Bluetooth: hci0: command 0x2042 tx timeout
lip 14 03:46:50 ubuntu kernel: Bluetooth: hci0: command 0x0c03 tx timeout
lip 14 03:46:58 ubuntu kernel: Bluetooth: hci0: HCI reset during shutdown failed
lip 14 03:47:02 ubuntu kernel: Bluetooth: hci0: urb 000000005be38381 failed to resubmit (113)
lip 14 03:47:02 ubuntu kernel: Bluetooth: hci0: urb 000000005fadadbf failed to resubmit (113)

```

Wcześniej też się pojawiają błędy niemniej po tych wklejonych to są już ostatnie związane z bluetooth i od tej pory już nic nie działa  
hcitool dev nie pokazuje żadnych podłączonych urządzeń, HA przestaje raportować temperaturę z czujników itp.

Co trzeba zrobić by znowu zaczęło wszystko działać to wpisać:

```auto
hciconfig hci0 down
hciconfig hci0 up

```

I wszystko wraca do normy.  
Najwyraźniej mój dongle jest zwalony? Ale być może ktoś miał podobny problem i go jakoś rozwiązał.

Tymczasowo chyba ustawie jakiś skrypt żeby po prostu stawiał bluetootha na nogi po padace.  
Sytuacja ma miejsce raz na dobę, zwykle w nocy.

W internetach jest trochę o tym, każą robić różne rzeczy ale u mnie nic nie zadziałało, to co robiłem już:

```auto
modprobe -r btusb && modprobe btusb
sudo setcap 'cap_net_raw,cap_net_admin+eip' `readlink -f \`which python3\``

```
