operating-system icon indicating copy to clipboard operation
operating-system copied to clipboard

bluetoothctl won't keep devices connected

Open shawly opened this issue 3 years ago • 13 comments
trafficstars

Describe the issue you are experiencing

I can't connect any bluetooth device to HA OS through bluetoothctl. Tried a bluetooth remote camera shutter which registers as input-keyboard and a Logitech MX Master.

I can reproduce the issue on two different HA OS instances on two different hosts with two different BT devices (a BT 5.0 USB Dongle and the internal BT module from an Intel NUC).

I cannot reproduce the issue on standard Linux machines or on the host machine itself, only within HA OS this problem exists. BT and BLE does work fine though in HA.

What operating system image do you use?

ova (for Virtual Machines)

What version of Home Assistant Operating System is installed?

7.3

Did you upgrade the Operating System.

No

Steps to reproduce the issue

  1. In a terminal execute bluetoothctl
  2. Execute scan on
  3. Copy the mac address of the device
  4. Execute pair <mac>
  5. Execute trust <mac>
  6. Execute connect <mac>

Example:

[bluetooth]# pair 11:22:33:FF:5F:AB
Attempting to pair with 11:22:33:FF:5F:AB
[CHG] Device 11:22:33:FF:5F:AB Connected: yes
[CHG] Device 11:22:33:FF:5F:AB Modalias: usb:v05ACp022Cd011B
[CHG] Device 11:22:33:FF:5F:AB UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device 11:22:33:FF:5F:AB UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 11:22:33:FF:5F:AB ServicesResolved: yes
[CHG] Device 11:22:33:FF:5F:AB Paired: yes
Pairing successful
[CHG] Device 11:22:33:FF:5F:AB ServicesResolved: no
[CHG] Device 11:22:33:FF:5F:AB Connected: no
bluetooth]# trust 11:22:33:FF:5F:AB
[CHG] Device 11:22:33:FF:5F:AB Trusted: yes
Changing 11:22:33:FF:5F:AB trust succeeded
[bluetooth]# connect 11:22:33:FF:5F:AB
Attempting to connect to 11:22:33:FF:5F:AB
[CHG] Device 11:22:33:FF:5F:AB ServicesResolved: yes
[CHG] Device 98:D3:31:FB:6F:F1 Connected: yes
Failed to connect: org.bluez.Error.NotAvailable
[CHG] Device 11:22:33:FF:5F:AB ServicesResolved: no
[CHG] Device 11:22:33:FF:5F:AB Connected: no

Anything in the Supervisor logs that might be useful for us?

Nothing apparent seems to be logged that relates to this

Anything in the Host logs that might be useful for us?

Nothing apparent, the bluetooth device just connects and thats it

[10188.610952] usb 2-1: new full-speed USB device number 3 using uhci_hcd
[10188.769742] usb 2-1: New USB device found, idVendor=8087, idProduct=0a2a, bcdDevice= 0.01
[10188.769784] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[10188.796889] Bluetooth: hci1: read Intel version: 370810011003110e32
[10188.796892] Bluetooth: hci1: Intel device is already patched. patch num: 32

System Health information

System Health

version core-2022.2.5
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.7
os_name Linux
os_version 5.10.91
arch x86_64
timezone Europe/Berlin
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 5000
Installed Version 1.22.0
Stage running
Available Repositories 1049
Downloaded Repositories 24
Home Assistant Supervisor
host_os Home Assistant OS 7.2
update_channel stable
supervisor_version supervisor-2022.01.1
docker_version 20.10.9
disk_total 31.3 GB
disk_used 5.7 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons Let's Encrypt (4.12.0), ESPHome (2022.1.3), TasmoAdmin (0.16.0), Node-RED (10.4.0), Mosquitto broker (6.0.1), Studio Code Server (4.1.0), MariaDB (2.4.0), InfluxDB (4.3.0), Terminal & SSH (9.3.0)
Lovelace
dashboards 3
resources 14
views 11
mode storage
Spotify
api_endpoint_reachable ok

Additional information

No response

shawly avatar Feb 09 '22 20:02 shawly

Did 7.4 maybe solve this issue?

It seems that the USB device got disconnected/reconnected somehow?

agners avatar Feb 25 '22 16:02 agners

Nope this issue persists since the first time I tested this with 6.x.

It seems that the USB device got disconnected/reconnected somehow?

Where?

shawly avatar Feb 25 '22 16:02 shawly

[10188.610952] usb 2-1: new full-speed USB device number 3 using uhci_hcd
[10188.769742] usb 2-1: New USB device found, idVendor=8087, idProduct=0a2a, bcdDevice= 0.01

This seems to be the Bluetooth device: http://linux-hardware.org/?id=usb:8087-0a2a

A reconnect at timestamp 10188 is suspicious.

agners avatar Feb 25 '22 16:02 agners

This is from when I attached the device to the virtual machine, so it's completely normal for the entry to show up

shawly avatar Feb 25 '22 16:02 shawly

Can you try if this is reproducible in 8.0 builds? It comes with newer Bluetooth stack which hopefully resolves the problem:

https://os-builds.home-assistant.io/8.0.dev20220404/

agners avatar Apr 05 '22 07:04 agners

I'll try thanks!

shawly avatar Apr 05 '22 10:04 shawly

Not the same issue exactly, I'm using Odroid N2+ and TP-link UB400 with integration Fjäråskupan and last working OS was 7.0.

Fjäråskupan or Bleak is little buggy with many errors and disconnects but it would always recover in OS 7.0. With OS 7.1 to 7.6 timeouts or errors within 1-5 min and won't recover.

Installed 8.0.dev220404 yesterday and Bluetooth is actually working better now than OS 7.0 with less errors and disconnects.

yada75 avatar Apr 10 '22 08:04 yada75

There hasn't been any activity on this issue recently. To keep our backlog manageable we have to clean old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant OS version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 09 '22 09:07 github-actions[bot]

So I tried it with 8.2 now and it behaves the same, the issue is still present and the bt connection drops after connecting.

shawly avatar Jul 09 '22 09:07 shawly

I can't connect any bluetooth device to HA OS through bluetoothctl. Tried a bluetooth remote camera shutter which registers as input-keyboard and a Logitech MX Master.

Both are input devices. How do you plan to use them with Home Assistant?

[bluetooth]# connect 11:22:33:FF:5F:AB
Attempting to connect to 11:22:33:FF:5F:AB
[CHG] Device 11:22:33:FF:5F:AB ServicesResolved: yes
[CHG] Device 98:D3:31:FB:6F:F1 Connected: yes
Failed to connect: org.bluez.Error.NotAvailable

I guess the problem is essentially this Failed to connect? Is this the same in 8.2? Is this appearing immediately or after a while?

I tried connecting my MX Master and it seems to connect fine, and at least stay connected for some minutes (probably longer, but I did not try beyond that).

agners avatar Jul 13 '22 09:07 agners

Both are input devices. How do you plan to use them with Home Assistant?

With this integration https://www.home-assistant.io/integrations/keyboard_remote/

Yes the behavior is the same in 8.2 and it appears immediately. I can do the same under a normal Ubuntu Server installation on a NUC or on my desktop Linux Mint installation and the camera shutter connects fine and stays connected, it's registered as keyboard.

shawly avatar Jul 13 '22 20:07 shawly

Can you share a bit more about your hardware? What Intel NUC model do you have? Waht BT 5.0 USB Dongle have you tried?

agners avatar Jul 14 '22 14:07 agners

I'm still using Home Assistant OS in a virtual machine and I tested it with the on-board Intel BT card and my ASUS BT500.

shawly avatar Jul 15 '22 14:07 shawly

There hasn't been any activity on this issue recently. To keep our backlog manageable we have to clean old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant OS version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 13 '22 15:10 github-actions[bot]