From 6b87a04dd55022c399e0efb0b4b220e86e95f8f2 Mon Sep 17 00:00:00 2001 From: lolouk44 Date: Mon, 10 Oct 2022 10:22:43 +0100 Subject: [PATCH] 0.3.5 --- CHANGELOG.md | 4 +++- src/Xiaomi_Scale.py | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 404038c..530be72 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ -## [0.3.5] - 2022-10-07 +## [0.3.5] - 2022-10-10 ### Added - Added extra logging. Logging Level can be set from config file. - Deprecated options MISCALE_VERSION, TIME_INTERVAL. +### Changed +- Restored HCI Settings ## [0.3.4] - 2022-10-05 ### Changed diff --git a/src/Xiaomi_Scale.py b/src/Xiaomi_Scale.py index 29a2b74..05742a3 100755 --- a/src/Xiaomi_Scale.py +++ b/src/Xiaomi_Scale.py @@ -240,7 +240,7 @@ def MQTT_publish(weight, unit, mitdatetime, hasImpedance, miimpedance): MQTT_DISCOVERY_PREFIX = "homeassistant" pass try: - HCI_DEV = data["HCI_DEV"][-1] + HCI_DEV = data["HCI_DEV"].lower() logging.debug(f"HCI_DEV read from config: {HCI_DEV}") except: HCI_DEV = "hci0" @@ -336,7 +336,10 @@ def callback(device, advertising_data): pass pass - async with BleakScanner(callback) as scanner: + async with BleakScanner( + callback, + device=f"{HCI_DEV}" + ) as scanner: ... # Important! Wait for an event to trigger stop, otherwise scanner # will stop immediately. @@ -350,5 +353,6 @@ def callback(device, advertising_data): logging.info(f"Initialization Completed, Waiting for Scale...") try: asyncio.run(main(MISCALE_MAC.lower())) - except: + except Exception as error: + logging.error(f"Unable to connect to Bluetooth: {error}") pass \ No newline at end of file