diff --git a/api/ble.py b/api/ble.py index 8d56311..df6a541 100644 --- a/api/ble.py +++ b/api/ble.py @@ -105,7 +105,13 @@ async def _scan_once() -> List[str]: A list of MAC addresses (upper-case as returned by Bleak). """ log.debug("Starting one-shot BLE scan (timeout = %.1fs)", SCAN_TIMEOUT) - devices = await BleakScanner.discover(timeout=SCAN_TIMEOUT) + try: + devices = await BleakScanner.discover(timeout=SCAN_TIMEOUT) + except Exception as e: + print(f"Error reading BLE data - {e}") + this_result = None + if "org.freedesktop.DBus.Error.AccessDenied" in e: + return [] return [dev.address for dev in devices if _is_match(dev.address, dev.name)]