|
|
@@ -48,8 +48,6 @@ async def ble_task():
|
|
|
global outdoorConnected
|
|
|
|
|
|
while True:
|
|
|
- disconnect_event = asyncio.Event()
|
|
|
-
|
|
|
device = await BleakScanner.find_device_by_name(outdoorName)
|
|
|
|
|
|
if device is None:
|
|
|
@@ -60,7 +58,7 @@ async def ble_task():
|
|
|
continue
|
|
|
|
|
|
try:
|
|
|
- async with BleakClient(device, disconnected_callback=lambda c: disconnect_event.set()) as client:
|
|
|
+ async with BleakClient(device) as client:
|
|
|
outdoorConnected = 1
|
|
|
print(f"connected to {outdoorName}")
|
|
|
|
|
|
@@ -68,8 +66,6 @@ async def ble_task():
|
|
|
await client.start_notify(PRESSURE_UUID, notification_handler)
|
|
|
await client.start_notify(HUMIDITY_UUID, notification_handler)
|
|
|
await client.start_notify(ALTITUDE_UUID, notification_handler)
|
|
|
-
|
|
|
- await disconnect_event.wait()
|
|
|
except Exception:
|
|
|
outdoorConnected = 0
|
|
|
print("exception while connecting or getting data")
|