From a5f5f1538b45f03af97d59e8ec8a9b17f8414c90 Mon Sep 17 00:00:00 2001 From: Florent Date: Wed, 26 Nov 2025 18:27:39 +0100 Subject: [PATCH] catch bleak error at ble scan --- src/meshcore_cli/meshcore_cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index 32edcd0..93cedf6 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -3537,7 +3537,14 @@ async def main(argv): logger.info(f"Searching first MC BLE device") else: logger.info(f"Scanning BLE for device matching {address}") - devices = await BleakScanner.discover(timeout=timeout) + try: + devices = await BleakScanner.discover(timeout=timeout) + except (BleakError, BleakDBusError): + print("BLE connection asked (default behaviour), but no BLE HW found") + print("Call meshcore-cli with -h for some more help (on commands)") + command_usage() + return + found = False for d in devices: if not d.name is None and d.name.startswith("MeshCore-") and\