Bluetooth adapter not finding devices

Hi all,

I have a ASUS USB-BT500 bluetooth adapter which is listed as being known for working that simply doesn’t discover any device, specifically I’m trying to configure a switchbot bot device.

I’m running hass as a container on a Fedora server using docker-compose, and this is how it’s configured

version: "3"
services:
  hass:
    container_name: homeassistant
    image: ghcr.io/home-assistant/home-assistant:stable
    network_mode: host
    hostname: homeassistant
    restart: on-failure
    privileged: true
    depends_on:
      - hass-db
      - influxdb
    environment:
      TZ: Europe/Rome
    volumes:
      - ./config:/config:z
      - /var/run/dbus:/var/run/dbus:ro

I’ve checked and inside the container I can see the device getting listed by bluetoothctl but homeassistant just doesn’t pick it up, the only thing I see in the logs is:

homeassistant | 2022-09-08 16:03:20.791 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] Initializing bluetooth scanner with {'scanning_mode': 'active', 'adapter': 'hci0'}
homeassistant | 2022-09-08 16:03:20.792 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Starting bluetooth discovery attempt: (1/3)
homeassistant | 2022-09-08 16:03:50.902 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 30.000848894
homeassistant | 2022-09-08 16:04:20.903 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 60.00137359799999
homeassistant | 2022-09-08 16:04:50.904 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 90.002548505
homeassistant | 2022-09-08 16:05:20.906 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 120.004645138
homeassistant | 2022-09-08 16:05:20.906 INFO (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Bluetooth scanner has gone quiet for 110s, restarting
homeassistant | 2022-09-08 16:05:20.907 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Stopping bluetooth discovery
homeassistant | 2022-09-08 16:05:20.913 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): adapter stopped responding; executing reset
homeassistant | 2022-09-08 16:05:22.130 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): adapter reset result: True
homeassistant | 2022-09-08 16:05:22.130 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Starting bluetooth discovery attempt: (1/3)
homeassistant | 2022-09-08 16:05:50.907 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 28.771589264
homeassistant | 2022-09-08 16:06:20.908 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 58.77214256999997
homeassistant | 2022-09-08 16:06:50.908 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 88.77254154799999
homeassistant | 2022-09-08 16:07:20.909 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 118.773082795
homeassistant | 2022-09-08 16:07:20.909 INFO (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Bluetooth scanner has gone quiet for 110s, restarting
homeassistant | 2022-09-08 16:07:20.909 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Stopping bluetooth discovery
homeassistant | 2022-09-08 16:07:20.921 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): adapter stopped responding; executing reset
homeassistant | 2022-09-08 16:07:22.128 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): adapter reset result: True
homeassistant | 2022-09-08 16:07:22.128 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Starting bluetooth discovery attempt: (1/3)
homeassistant | 2022-09-08 16:07:50.909 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 28.776065924000022
homeassistant | 2022-09-08 16:08:20.910 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 58.77687990200002
homeassistant | 2022-09-08 16:08:50.911 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 88.77737710399998
homeassistant | 2022-09-08 16:09:20.913 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 118.77947430500006
homeassistant | 2022-09-08 16:09:20.913 INFO (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Bluetooth scanner has gone quiet for 110s, restarting
homeassistant | 2022-09-08 16:09:20.913 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Stopping bluetooth discovery
homeassistant | 2022-09-08 16:09:20.920 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): adapter stopped responding; executing reset
homeassistant | 2022-09-08 16:09:22.138 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): adapter reset result: True
homeassistant | 2022-09-08 16:09:22.138 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Starting bluetooth discovery attempt: (1/3)
homeassistant | 2022-09-08 16:09:50.914 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 28.765906545999997
homeassistant | 2022-09-08 16:10:20.915 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 58.76768095900002
homeassistant | 2022-09-08 16:10:50.917 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 88.76963896899997
homeassistant | 2022-09-08 16:11:20.919 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 118.77132660099994
homeassistant | 2022-09-08 16:11:20.919 INFO (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Bluetooth scanner has gone quiet for 110s, restarting
homeassistant | 2022-09-08 16:11:20.919 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Stopping bluetooth discovery
homeassistant | 2022-09-08 16:11:20.922 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): adapter stopped responding; executing reset
homeassistant | 2022-09-08 16:11:22.134 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): adapter reset result: True
homeassistant | 2022-09-08 16:11:22.134 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Starting bluetooth discovery attempt: (1/3)
homeassistant | 2022-09-08 16:11:50.920 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (04:42:1A:5A:4F:60): Scanner watchdog time_since_last_detection: 28.776687868000067

what should I do to solve this?

Hi

I’ve a similar configuration (Lenovo laptop with Ubuntu and H.A. in Docker) and had the same exact need, i.e. connecting a Switchbot bot.

I initially thought the issue (of not discoverying anything) was on the bluetooth adapter as stated in some threads. I was also going to buy a dongle.

But then following a few steps at a time I managed to get the SwitchBot connected through the integrated bluetooth.

  1. I activated the Laptop Bluettoh (which was disabled)
  2. I learned that I had to start the bluetooth Integration inside Home Assistant
    2a) Initially it didn0t work as it required to restart the docker with an additional -V option parameter
  3. even if starting the SwitchBot integration, it didn’t discovered anything
    3a) I did a few check through bluetoothctl , but I’m not sure they were part of the solution
    3b) I left the system alone and after a while (some hours) the switchbot bot had been found and added (together with a Govee thermometer I even forgot it was around bluetoothing).

  1. after the reboot today the two bluetooth devices are not found (Unknown) . Waiting for a few to see if they are coming back in their due time.

If they do I might give you some more help in how to get there.

Cheers.
Phil

Actually the two devices just re-appeared, after 20 minutes from reboot, and after I issued a bluetoothctl scan command. (Which at the moment keeps reporting infinite [CHG] verbose response from devices if I try to get inside bluetoothctl again.)

I also exported the SwitchBot from Home Assistant to Google home, so I can voice command it (without the SwitchBot Hub otherwise required).

Cheers
Phil

For starters, using the built in terminal from the Add On store, see if you can run bluetoothctl. If you get a dbus error then follow the docs to setup dbus-broker and reboot.

I had the exact same issue though I’m running Fedora IoT with podman.

I haven’t figured out exactly what is causing my issue but I noticed it’s related to SELinux. I temporarily disabled it, restarted HA and it started to pick up devices.

I can see that your second volume (for mounting the dbus socket) isn’t defined according to the HA Docs. Maybe start by changing it to - /run/dbus:/run/dbus:ro, it might be the culprit

"Looks that BT can’t use with HA when it’s installed by VirtualBox and haos_ova_10.1.vdi
It looks that HA configuration is defined so that dbus never starts (it’s defined as RW:false).
I’m tried any possible way that I can imagine - but dbus/BT never start in this configuration.

My BT works normally in Linux (in this device) and even with HA if I starts HA using/set docker
directly from Linux OS/terminal.
In this way I had remote connect problems even in local private network.

Could anybody help? How BT could be activate with haos_ova_10.1.vdi?
Documentation not helps anything."

BTW - command:

# systemctl enable dbus-broker.service

works fine in Linux terminal but not inside HA. In HA I have to use bluetoothctl-command with zsh-terminal. Is there in HA better terminal available for?

Now - later, I noticed; HA is reserved dbus and denied to search any BT devices that are not paired earlier in Linux Mint OS. And still, BT not working in HA. (After I forced to run dbus in HA.)

I finally found reason for this problem:

  • Oracle VirtualBox prevent Bluetooth to start in default?

Anyway I changed some settings in VB, I’m not sure what is really needed but, I changed these ones:

  • enable Audio input (I haven’t microphone, but still … don’t ask why)
  • USB device filter added - Intel Corp. [0001] - my BT isn’t USB device, it’s inside of the Motherboard
    (anyway, maybe this helps? I set this option 1st time)
  • not any changes in original configuration.yaml

After rebooting the HA, it founds the BT “adapter” immediately. My best greetings to Oracle teams! :wink: