Bluetooth problem in 0.98.0

Hello.

I’m not sure exactly where to put this, so I’ll try the Configuration topic.

I run Home Assistant in Docker on Ubuntu, on a NUC7PYJH. Here’s a snippet of my docker-compose.yaml.

  homeassistant:
    image: homeassistant/home-assistant
    container_name: home-assistant
    restart: unless-stopped
#    ports:
#      - 8123:8123
    depends_on:
      - mqtt
      - mariadb
      - influxdb
    volumes:
      - /home/jcuccia/docker_files/hass:/config
      - /etc/localtime:/etc/localtime:ro
      - /root/.ssh:/root/.ssh
    devices:
      - /dev/ttyACM0:/dev/ttyACM0
#      - /dev/ttyUSB0:/dev/ttyUSB0
    network_mode: host

This all worked fine until I upgraded to v 0.98.0 Since upgrading, the Bluetooth device tracker does not work. The below error gets logged. I’m wondering if this is related to the switch to Alpine Linux in the Docker image? Here’s the error I see:

2019-08-29 11:40:52 INFO (MainThread) [homeassistant.setup] Setting up device_tracker
2019-08-29 11:40:53 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.legacy
2019-08-29 11:40:54 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 77, in async_setup_legacy
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 97, in setup_scanner
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 72, in discover_devices
2019-08-29 11:40:54 INFO (MainThread) [homeassistant.setup] Setup of domain device_tracker took 2.2 seconds.

Any help will be appreciated.

– John

Further to this, here’s a log with a bit more detail. My Bluetooth hardware works, as I can do both BT and BTLE scans with hcitool. Thanks.

2019-08-30 18:02:24 INFO (SyncWorker_15) [homeassistant.loader] Loaded bluetooth_tracker from homeassistant.components.bluetooth_tracker
  File "/usr/local/lib/python3.7/site-packages/bluetooth/bluez.py", line 31, in discover_devices
_bluetooth.error: (4, 'Interrupted system call')
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 97, in setup_scanner
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 72, in discover_devices
  File "/usr/local/lib/python3.7/site-packages/bluetooth/bluez.py", line 34, in discover_devices
    raise BluetoothError ("error communicating with local "
bluetooth.btcommon.BluetoothError: error communicating with local bluetooth adapter

OK, found this in the Alpine Linux wiki. If it applies to the NUC as well as to the RPi, that’s my problem. I have a Z-Stick using ttyACM0.

Raspberry Pi 3 - Setting Up Bluetooth

Excerpt:

You can get Bluetooth to work only if you are not using the UART (ttyAMA0) for anything else, for example serial console. 

I’m still trying to figure out what happened to the Bluetooth device tracker in my installation.

I find that bluetoothd is running in the Ubuntu host, but not in the HA docker container. Does anyone know if that is how things are supposed to work?

I encountered the same problem (and error messages) in Docker after upgrading to 0.98.X images. The Docker host is a Debian Stretch virtual machine. Like you I suspect it’s related to the switch to Alpine.

Bluetooth device-tracker runs on my pre-Alpine 0.97.2 version container while bluetoothd runs on the host.

While looking for an alternate source of semi-official and routinely updated non-Alpine images on Docker Hub found these HA images for Intel NUC which might work for you.

Thanks. The broken BT tracker isn’t a show-stopper for me. I trust that it’ll get fixed eventually.

A quick update: I can access the bluetooth adapter from inside the container. I start a shell

docker exec -it home-assistant sh

and can then run hcitool scan and hcitool lescan. So it seems that the hardware is accessible to Alpine but not to Home Assistant.

+1

I have the same issue:
blue tooth.btcommon.BluetoothError: error communicating with local blue tooth adapter

Started on upgrade from 0.94.0 to 0.98.4.

Platform: HA/Docker/NUC.

Joel

Looks like a trend, then.

I just opened an issue.