Bluetooth Low Energy platform Agnostic Klient
Project description
Bleak is an acronym for Bluetooth Low Energy platform Agnostic Klient.
Free software: MIT license
Documentation: https://bleak.readthedocs.io.
Bleak is a GATT client software, capable of connecting to BLE devices acting as GATT servers. It is designed to provide a asynchronous, cross-platform Python API to connect and communicate with e.g. sensors.
Installation
$ pip install bleak
Features
Supports Windows 10, version 16299 (Fall Creators Update) or greater
Supports Linux distributions with BlueZ >= 5.55
OS X/macOS support via Core Bluetooth API, from at least OS X version 10.13
Android backend compatible with python-for-android
Bleak supports reading, writing and getting notifications from GATT servers, as well as a function for discovering BLE devices.
Usage
To discover Bluetooth devices that can be connected to:
import asyncio
from bleak import BleakScanner
async def main():
devices = await BleakScanner.discover()
for d in devices:
print(d)
asyncio.run(main())
Connect to a Bluetooth device and read its model number:
import asyncio
from bleak import BleakClient
address = "24:71:89:cc:09:05"
MODEL_NBR_UUID = "2A24"
async def main(address):
async with BleakClient(address) as client:
model_number = await client.read_gatt_char(MODEL_NBR_UUID)
print("Model Number: {0}".format("".join(map(chr, model_number))))
asyncio.run(main(address))
DO NOT NAME YOUR SCRIPT bleak.py! It will cause a circular import error.
See examples folder for more code, for instance example code for connecting to a TI SensorTag CC2650
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bleak-1.1.1.tar.gz.
File metadata
- Download URL: bleak-1.1.1.tar.gz
- Upload date:
- Size: 116.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeef18053eb3bd569a25bff62cd4eb9ee56be4d84f5321023a7c4920943e6ccb
|
|
| MD5 |
e176e942a79869ee3dc9c16df42cbdd9
|
|
| BLAKE2b-256 |
10886bb2bcb94ef7a2f37c5bd5ec99a4ae9208c4caa3fa6d203f9b601e047e64
|
File details
Details for the file bleak-1.1.1-py3-none-any.whl.
File metadata
- Download URL: bleak-1.1.1-py3-none-any.whl
- Upload date:
- Size: 136.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e601371396e357d95ee3c256db65b7da624c94ef6f051d47dfce93ea8361c22e
|
|
| MD5 |
3b2562ccd80b358ea685ec6d2468d2de
|
|
| BLAKE2b-256 |
815ac3378ba7b05abc7c2d95ae492eac0523d937c77afcb9ff7e7f67fe2ca11d
|