{"id":4560,"library":"habluetooth","title":"High availability Bluetooth","description":"habluetooth is a Python library providing high-availability Bluetooth scanning and device management, built on top of Bleak. It aims to offer robust Bluetooth integration, often used in home automation contexts. The current version is 6.0.0. The project maintains an active and frequent release cadence, often with multiple updates per month, incorporating new features and bug fixes.","status":"active","version":"6.0.0","language":"en","source_language":"en","source_url":"https://github.com/bluetooth-devices/habluetooth","tags":["bluetooth","ble","async","home-automation","scanner"],"install":[{"cmd":"pip install habluetooth","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"BluetoothManager","correct":"from habluetooth import BluetoothManager"},{"note":"While 'from habluetooth.scanner import HaBleakScannerWrapper' works, the class is re-exported at the top-level for convenience.","wrong":"from habluetooth.scanner import HaBleakScannerWrapper","symbol":"HaBleakScannerWrapper","correct":"from habluetooth import HaBleakScannerWrapper"}],"quickstart":{"code":"import asyncio\nfrom habluetooth import BluetoothManager, HaBleakScannerWrapper\n\nasync def main():\n    manager = BluetoothManager()\n    await manager.async_setup()\n    scanner = HaBleakScannerWrapper(manager)\n\n    print(\"Starting Bluetooth scan...\")\n    async with scanner:\n        # Iterate over discovered devices and their advertisement data\n        async for device, advertisement_data in scanner.advertisement_data:\n            print(f\"Device: {device.name or device.address}, RSSI: {advertisement_data.rssi}, Services: {advertisement_data.service_uuids}\")\n            # Uncomment the line below to stop after the first detected device\n            # break\n    await manager.async_stop()\n\nif __name__ == \"__main__\":\n    try:\n        asyncio.run(main())\n    except KeyboardInterrupt:\n        print(\"Scan interrupted by user.\")","lang":"python","description":"This quickstart demonstrates how to initialize the `BluetoothManager`, set up a `HaBleakScannerWrapper`, and asynchronously iterate over discovered Bluetooth devices and their advertisement data. Run this script to see local Bluetooth devices and their basic information."},"warnings":[{"fix":"Update `HaBleakScannerWrapper` usage to leverage the new async iterator patterns (e.g., `scanner.advertisement_data`) or `discovered_devices_and_advertisement_data` methods, as demonstrated in the quickstart. Direct callback registration is no longer supported.","message":"Version 6.0.0 removes `BaseBleakScanner` inheritance from `HaBleakScannerWrapper` and the `register_detection_callback` method. Code relying on these old Bleak patterns will no longer work.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Ensure your development and deployment environments are running Python 3.11 or a more recent version. Consider using virtual environments to manage Python versions effectively.","message":"The `habluetooth` library requires Python 3.11 or newer. Installations or attempts to run on older Python versions will fail or result in compatibility errors.","severity":"gotcha","affected_versions":"all"},{"fix":"For production or stable environments, consider pinning the `habluetooth` version in your `requirements.txt` to a specific minor version (e.g., `habluetooth~=6.0`) to avoid unexpected changes from newer releases. Regularly review the GitHub release notes before updating.","message":"habluetooth maintains a rapid release cadence, often publishing multiple versions within a month. While this indicates active development, it means minor API adjustments or bug fixes can land frequently.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}