Skip to content

Commit

Permalink
0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lolouk44 committed Sep 21, 2022
1 parent fa32a55 commit 254fdb4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Xiaomi_Scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ async def main(address, char_uuid):
await client.stop_notify(BODY_COMPOSITION_MEASUREMENT)
await client.disconnect()
except Exception as err:
if str(err)[0:28] == "[org.bluez.Error.InProgress]" or str(err)[0:26] == "[org.bluez.Error.NotReady]":
"""if str(err)[0:28] == "[org.bluez.Error.InProgress]" or str(err)[0:26] == "[org.bluez.Error.NotReady]":
sys.stdout.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Could Not Connect to Scale\n\t({err})\n\tTrying to Reset Bluetooth Adapter...\n")
sys.stdout.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Bluetooth Power Off...\n")
cmd = 'hciconfig power off' #hci' + HCI_DEV + ' down'
Expand All @@ -293,7 +293,8 @@ async def main(address, char_uuid):
sys.stdout.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Bluetooth Adapter Reset...\n")
await asyncio.sleep(5)
elif len(str(err)) != 0 and str(err)[0:24] != "[org.bluez.Error.Failed]" and str(err)[0:19] != "Device with address" and str(err) != "Not connected":
sys.stdout.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Could Not Connect to Scale, Retrying...\n\t{err}\n")
sys.stdout.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Could Not Connect to Scale, Retrying...\n\t{err}\n")"""
sys.stdout.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Could Not Connect to Scale, Retrying...\n\t{err}\n")
pass

if __name__ == "__main__":
Expand Down

0 comments on commit 254fdb4

Please sign in to comment.