tessl install tessl/pypi-bleak@1.1.0Cross-platform Bluetooth Low Energy GATT client library for asynchronous BLE communication
Agent Success
Agent success rate when using this tile
97%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.07x
Baseline
Agent success rate without this tile
91%
A robust Bluetooth Low Energy device connection manager that implements comprehensive error handling for BLE operations.
The system must check if Bluetooth is available before attempting any BLE operations.
The system must discover BLE devices and handle discovery failures appropriately.
The system must read device characteristics and handle characteristic-related errors.
The system must handle base BLE errors that don't fall into specific categories.
@generates
from typing import Optional, Dict, Any
def check_bluetooth_availability() -> Dict[str, Any]:
"""
Check if Bluetooth is available on the system.
Returns:
Dict with 'available' (bool) and optionally 'error_type' (str) keys.
Error types: 'no_adapter', 'powered_off', 'permission_denied'
"""
pass
def find_device_by_address(address: str, timeout: float = 5.0) -> Optional[Dict[str, str]]:
"""
Find a BLE device by its address.
Args:
address: The Bluetooth device address to find
timeout: Discovery timeout in seconds
Returns:
Dict with device info ('address', 'name') if found, None if not found
"""
pass
def read_device_characteristic(address: str, characteristic_uuid: str) -> Dict[str, Any]:
"""
Connect to a device and read a characteristic value.
Args:
address: The Bluetooth device address
characteristic_uuid: UUID of the characteristic to read
Returns:
Dict with 'success' (bool), and either 'value' (bytes) or 'error' (str)
Error types: 'characteristic_not_found', 'ble_error', 'connection_failed'
"""
passProvides cross-platform Bluetooth Low Energy support with comprehensive exception handling.