bleak-retry-connector
A connector for Bleak Clients that handles transient connection failures
What it is and what it does
Bleak Retry Connector is a wrapper around the Bleak Bluetooth Low Energy client that adds automatic retry logic for transient connection failures. Instead of calling BleakClient.connect() directly, you call establish_connection() with your device and a retry count, and the library handles retries with intelligent backoff, service caching, and platform-specific workarounds. It solves common Bluetooth connection problems like timeouts on first attempt, "out of connection slots" errors on ESP32 devices, and interference from other Bluetooth operations.
The package provides BleakClientWithServiceCache, which caches GATT services to speed up reconnections, and establish_connection(), which orchestrates the retry loop and error handling. It's designed for applications that need reliable Bluetooth connectivity across different operating systems and device types, particularly where transient failures are common or connection slots are limited.
Use it for:
- IoT applications connecting to multiple BLE devices where occasional timeouts or slot exhaustion occur.
- Mobile or desktop apps that need to reconnect to wearables or sensors with automatic retry on failure.
- Embedded device communication (e.g., ESP32) where connection slots are limited and retries are essential.
- Long-running services that maintain persistent Bluetooth connections and need resilience to transient network glitches.
- Testing or debugging Bluetooth devices where connection instability is expected during development.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps Bleak's Bluetooth client with automatic retry logic and backoff to handle transient connection failures, including service caching for faster reconnections.
Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and solves a real problem in Bluetooth connectivity. If your application uses Bleak and experiences transient connection failures, this wrapper is a straightforward drop-in that adds retry logic and service caching with minimal overhead. Install it if you need reliable reconnection handling; skip it only if your use case has no tolerance for retries or you manage reconnection logic yourself.
Install
bleak-retry-connector on PyPI
pip
pip install bleak-retry-connectoruv
uv add bleak-retry-connectorpoetry
poetry add bleak-retry-connectorInstalling bleak-retry-connector
Before you install
Low friction: pure Python wheel with four runtime dependencies (bleak, async-timeout, bluetooth-adapters, dbus-fast). Actively maintained as of 2026-07-22, last commit 2026-08-10.
License in practice
MIT license permits commercial and private use with minimal restrictions; attribution required.
Quickstart
pip install bleak-retry-connector
import asyncio
from bleak_retry_connector import establish_connection, BleakClientWithServiceCache
async def connect():
client = await establish_connection(
BleakClientWithServiceCache,
device,
"Device Name",
max_attempts=3
)
await client.disconnect()
asyncio.run(connect())
Requires Python 3.10 or later; dbus-fast may require system dbus development libraries on Linux.
Verify before relying
- Whether service caching persists across process restarts or only within a session.
- Specific backoff strategy and timing between retry attempts.
- How platform-specific quirks are detected and handled (Windows vs. macOS vs. Linux).
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — async-timeout, bleak, bluetooth-adapters, dbus-fast |
| Maintenance | actively maintained — 23 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,010,703/month — #4,514 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bleak_retry_connector-4.6.3-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
bleak-esphomeProvides a Bleak backend that proxies Bluetooth…
permissive · top 15,000 on PyPI
home-assistant-bluetoothProvides standardized data models and helpers…
permissive · top 15,000 on PyPI
habluetoothProvides high-availability Bluetooth…
permissive · top 5,000 on PyPI
kegtron-bleProvides Bluetooth Low Energy (BLE) support for…
permissive · top 15,000 on PyPI
govee-bleProvides Python bindings to discover, connect…
permissive · top 15,000 on PyPI
bleakBleak is an async Python client for connecting…
permissive · top 5,000 on PyPI
bluetooth-auto-recoveryDetects and recovers Bluetooth adapters that…
permissive · top 15,000 on PyPI
ibeacon-bleParses and decodes iBeacon BLE (Bluetooth Low…
permissive · top 15,000 on PyPI
bluetooth-sensor-state-dataProvides data models for parsing, storing, and…
permissive · top 15,000 on PyPI
idasen-haProvides a Home Assistant helper library for…
permissive · top 15,000 on PyPI