From 44eb88ef0a8347c1d9dee4540c679b6bbbd50abc Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 16 Oct 2026 22:13:03 -0700 Subject: [PATCH] add another except to the _discover_device function --- api/ble.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/ble.py b/api/ble.py index 4f6c0f1..d1b4d1a 100644 --- a/api/ble.py +++ b/api/ble.py @@ -78,6 +78,8 @@ async def _discover_device(mac: str) -> Optional[str]: log.warning("Device %s not found in scan", mac) except asyncio.TimeoutError: log.warning("Discover call timed out after %.1fs for %s", SCAN_TIMEOUT + 2.0, mac) + except Exception as e: + log.error(f"Dicvoere call failed - {e}") return None def _parse_sensor_data(raw: bytes) -> (float, int): @@ -223,6 +225,7 @@ def read_data_sync(mac: str) -> Optional[SensorReading]: def reset_adapter(): log.info("Restting BT Adapter...") log.info(subprocess.run(["sudo", "rfkill", "block", "bluetooth"], capture_output=True, text=True, check=True).stdout) + time.sleep(2) log.info(subprocess.run(["sudo", "rfkill", "unblock", "bluetooth"], capture_output=True, text=True, check=True).stdout) time.sleep(5) log.info("Reset complete. ")