Skip to content

Commit

Permalink
fix: prevent crash when BLE sends 'turned off' error
Browse files Browse the repository at this point in the history
  • Loading branch information
builder555 committed Mar 12, 2023
1 parent 94985dc commit 8016111
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def read_characteristic(self, handle: BleakGATTCharacteristic) -> bytes:
await self.ensure_connected()
return await self.client.read_gatt_char(handle) #type: ignore
except BleakError as e:
if str(e).lower() == 'disconnected':
if str(e).lower() == 'disconnected' or str(e).lower().find('turned off') >= 0:
raise DeviceDisconnectedException
raise e

Expand Down

0 comments on commit 8016111

Please sign in to comment.