add exception handler for scan_macs
This commit is contained in:
1 parent
36c82592e5
commit
0dc1a66980
1 file changed
+7
-1
+7
-1
@@ -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)]
|
||||
|
||||
|
||||
Reference in new issue
Block a user