From 0480a76c71d01c302f0ebb2d3215185e46c19ff5 Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 21 Oct 2026 20:23:30 -0700 Subject: [PATCH] ble - testing without discovery --- api/ble.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/api/ble.py b/api/ble.py index b1a5a82..0b6eac1 100644 --- a/api/ble.py +++ b/api/ble.py @@ -182,17 +182,17 @@ def _is_match(mac: str, name: str) -> bool: #################################################### async def read_data(mac: str) -> Optional[SensorReading]: - try: - address = await asyncio.wait_for( - _discover_device(mac), - timeout=DISCOVER_TIMEOUT, - ) - except asyncio.TimeoutError: - log.warning("Device discovery timed out for %s after %.1fs", mac, DISCOVER_TIMEOUT) - return None - - if not address: - return None +# try: +# address = await asyncio.wait_for( +# _discover_device(mac), +# timeout=DISCOVER_TIMEOUT, +# ) +# except asyncio.TimeoutError: +# log.warning("Device discovery timed out for %s after %.1fs", mac, DISCOVER_TIMEOUT) +# return None +# +# if not address: +# return None try: async with BleakClient(address, timeout=CONNECT_TIMEOUT) as client: @@ -376,6 +376,7 @@ def restart_bt_service(): log.info(subprocess.run(["systemctl", "stop", "bluetooth.service"], capture_output=True, text=True, check=True).stdout.strip()) time.sleep(2) log.info(subprocess.run(["systemctl", "start", "bluetooth.service"], capture_output=True, text=True, check=True).stdout.strip()) + time.sleep(2) # this will return the USB ID based on systems scans def get_usb_id():