From 4622343bf3e4a03e5dc740e55b7ef75b47cbdef0 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 15 Oct 2026 00:09:43 -0700 Subject: [PATCH] reset adapter subroutine to ble --- api/ble.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/ble.py b/api/ble.py index 6234407..40b5778 100644 --- a/api/ble.py +++ b/api/ble.py @@ -18,6 +18,7 @@ provided for convenience. """ import asyncio +import subprocess import warnings, logging warnings.filterwarnings("ignore") logging.getLogger('apscheduler').setLevel(logging.ERROR) @@ -191,9 +192,14 @@ def read_data_sync(mac: str) -> Optional[SensorReading]: # --------------------------------------------------------------------------- # -# Original helper functions +# Other helper functions # --------------------------------------------------------------------------- # +def reset_adapter(): + subprocess.run(["sudo", "rfkill", "block", "bluetooth"], check=True) + subprocess.run(["sudo", "rfkill", "unblock", "bluetooth"], check=True) + def sensor_data_query(mac_list: List[str]) -> List[dict]: + reset_adapter() result = [] for mac in mac_list: try: