The bluetooth component provides low-level Bluetooth communication and discovery utilities.
The BleScanner scans for nearby Bluetooth Low Energy devices.
It returns discovered devices as BleDeviceInfo objects.
Each device may contain:
The scanner returns all discovered BLE devices and does not filter them by protocol or device type.
There are two independent requirements:
The Raspberry Pi model does not determine which Python package to install. It only determines whether Bluetooth hardware is built in. Raspberry Pi 3 and newer boards, plus the Zero W and Zero 2 W, have built-in Bluetooth. Other boards require a USB Bluetooth adapter with BLE support. In practice, the Raspberry Pi OS release and its Python and BlueZ versions matter more than the board model.
This component requires Python 3.10 or newer. The current bleak release also requires Python 3.10 or newer. Check the interpreter before installing:
On Raspberry Pi OS Bookworm and newer, install Python packages in a virtual environment:
On an older OS that does not enforce externally managed Python environments, a virtual environment is still recommended. Do not use --break-system-packages to modify Raspberry Pi OS's system Python.
Python 3.8 and 3.9 can install the older bleak==0.22.3, but they cannot run this component because the component itself uses Python 3.10 language and standard-library features. Upgrade Python or the OS instead of pinning an old bleak release.
Current bleak releases require BlueZ 5.55 or newer. On Debian, Ubuntu, or Raspberry Pi OS, install the Bluetooth service and command-line tools with:
Check both BlueZ and the adapter before scanning:
If bluetoothctl show reports no controller, confirm that the board has built-in Bluetooth or attach a BLE-capable USB adapter. Also check that the controller is not blocked:
Very old Raspberry Pi OS images may ship BlueZ older than 5.55 and Python older than 3.10. For those systems, upgrading Raspberry Pi OS is the supported path; changing only the bleak version does not update the system Bluetooth stack.
A BLE scanner CLI component test is provided in the component_test directory.
Run the component test from the project root:
The default scan duration is 10 seconds.
A different scan duration can be specified using --timeout:
Example output:
The Bluetooth component provides generic Bluetooth discovery and communication functionality.
It does not identify devices for a specific protocol or assign meaning to discovered devices.