Mobly Bluetooth Controller
Mobly Bluetooth controller module for using Python code to operate Bluetooth reference devices in Mobly tests.
It supports two kinds of reference devices:
- A Raspberry Pi used as a Bluetooth reference peer (
RpiDevice). - BES Bluetooth development boards, as a single board (
BesDevice) or as a pair of true wireless earbuds (TwsDevice).
Requirements
- Python 3.11+
- Mobly 1.12.2+
Installation
pip install mobly-bluetooth
Start to Use
Mobly Bluetooth controller is an add-on module for Mobly. To learn more about Mobly, visit Getting started with Mobly.
Ensure the reference device is reachable via SSH
Mobly tests run on a single host computer.
To use a Raspberry Pi reference device in Mobly tests, connect it to your local network and confirm SSH access from the host machine.
Write Mobly Device Configs
Write a testbed config to specify the information of the reference device. For example:
sample_config.yaml
TestBeds:
- Name: SampleBluetoothTestbed
Controllers:
RpiDevice:
- hostname: 'IP_ADDRESS'
username: 'USERNAME'
password: 'PASSWORD'
NOTE: Replace IP_ADDRESS, USERNAME, and PASSWORD with the SSH login
information of the Raspberry Pi. You can use keyfile instead of password to
log in with an SSH key.
Write a Hello World Mobly Test
This example test connects to the Raspberry Pi and prints its kernel version.
hello_world_test.py
"""A basic Mobly test with a Raspberry Pi Bluetooth reference device."""
from mobly import base_test
from mobly import test_runner
from mobly_bluetooth.controllers import rpi_device
class HelloWorldTest(base_test.BaseTestClass):
def setup_class(self):
# Register controller for the Raspberry Pi reference device.
self.ref = self.register_controller(rpi_device)[0]
def test_print_kernel_version(self):
output = self.ref.ssh.execute_command('uname -a')
self.ref.log.info('Kernel version: %s', output)
if __name__ == '__main__':
test_runner.main()
Execute the Test
python hello_world_test.py -c sample_config.yaml
Use BES development boards
BES boards are connected to the host computer over USB. Use BesDevice for a
single board, or TwsDevice for a pair of boards that act as true wireless
earbuds. Both are registered through the bluetooth_reference_device module:
from mobly_bluetooth.controllers import bluetooth_reference_device
ref = self.register_controller(bluetooth_reference_device)[0]
Security
Eligibility for the Google Open Source Software Vulnerability Rewards Program is determined by the Google Open Source Software Vulnerability Reward Program Rules.
License
This project is licensed under the Apache License, Version 2.0. See LICENSE for details.
Metadata
Release files for mobly-bluetooth 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mobly_bluetooth-0.1.0.tar.gz | 98.9 kB | With provenance | Details for mobly_bluetooth-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mobly_bluetooth-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mobly_bluetooth-0.1.0-py3-none-any.whl |
Total release size: 215.7 kB
Release files / mobly_bluetooth-0.1.0.tar.gz
| Download URL | mobly_bluetooth-0.1.0.tar.gz |
|---|---|
| Size | 98.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92113a5c81f500c82bdb000356d71bd2406a6fd2523062ea01b2616fa08afce6
|
|
BLAKE2b-256 checksum How to use checksums |
3bad1f856937f8363c7845ff0a04ff30eac23a025a3a8b727385f2a3de14747b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / mobly_bluetooth-0.1.0-py3-none-any.whl
| Download URL | mobly_bluetooth-0.1.0-py3-none-any.whl |
|---|---|
| Size | 116.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31558e61fd85b453fe220ef07d72b8ae4425900fff34e3c882698bdd0b9e3048
|
|
BLAKE2b-256 checksum How to use checksums |
5d3e430dde30fad45c44af2ae35daa83f8e2f50ca0f2e86de9ede1f9a68469ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for mobly-bluetooth 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mobly_bluetooth-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.