-
DescriptionI want to use bleak to scan Bluetooth beacons from a Docker container. I am coming from a bluepy installation that worked without configure anything, except for disabling bluetooth from the operating system, otherwise the resource would result occupied. When I start the container, bleak tells me that it can't find any adapter with this error:
What I DidSo, at startup, as I said I close the OS bluetooth service with Then I have a Docker compose for the services that I am using, in particular for the scanner I wrote
The dockerfile I am using is this:
With entrypoint.sh #!/usr/bin/env bash
ARGS="$@"
service dbus start
bluetoothd &
python3 -u ./main.py $ARGS My python code is at the moment taken from the documentation: import asyncio
from bleak import BleakScanner
async def scanner_runner():
stop_event = asyncio.Event()
scan_time = 15
for i in range(0, 20 * 60, scan_time):
async with BleakScanner(lambda dev, adv: print(dev, adv)) as scanner:
await stop_event.wait(scan_time)
asyncio.run(scanner_runner()) At the very beginning of the container I am also calling from python the process Am I missing something or is it incompatible? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
What happens if you run |
Beta Was this translation helpful? Give feedback.
-
So, apparently using |
Beta Was this translation helpful? Give feedback.
So, apparently using
killall -9 bluetoothd
doesn't do much, it kills the bluetooth service but then for a Raspberry card the service is triggered again to open. This caused the bluetooth card to be busy and so being invisible for bluez inside the docker container. I was able to disable the bluetooth service in the OS, and bluez and consequently bleak, started working. Sorry for the trouble, in the end it wasn't even related to bleak