Skip to content

Commit 1f7cecd

Browse files
authored
feat: use changed_manufacturer_data from newer bluetooth-sensor-state-data (#95)
1 parent 4977235 commit 1f7cecd

File tree

3 files changed

+54
-75
lines changed

3 files changed

+54
-75
lines changed

poetry.lock

Lines changed: 51 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ bleak = {version = ">=0.21.1", python = ">=3.10,<3.14"}
2929
Sphinx = {version = ">=5,<7", optional = true}
3030
sphinx-rtd-theme = {version = ">=1,<4", optional = true}
3131
myst-parser = {version = ">=0.18,<1.1", optional = true}
32-
bluetooth-sensor-state-data = ">=1.6.1"
32+
bluetooth-sensor-state-data = ">=1.8.0"
3333
sensor-state-data = {version = ">=2.0.2", python = ">=3.11,<4"}
3434
bluetooth-data-tools = ">=1.28.0"
3535
habluetooth = {version = ">=3.42.0", python = ">=3.11,<3.14"}

src/thermopro_ble/parser.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from math import tanh
1414
from struct import Struct
1515

16-
from bluetooth_data_tools import parse_advertisement_data_bytes, short_address
16+
from bluetooth_data_tools import short_address
1717
from bluetooth_sensor_state_data import BluetoothData
1818
from sensor_state_data import SensorLibrary
1919

@@ -60,14 +60,7 @@ def _start_update(self, service_info: BluetoothServiceInfoBleak) -> None:
6060
self.set_device_name(name)
6161
self.set_precision(2)
6262
self.set_device_manufacturer("ThermoPro")
63-
if service_info.raw:
64-
# If we have the raw data we don't need to work out
65-
# which one is the newest.
66-
_, _, _, changed_manufacturer_data, _ = parse_advertisement_data_bytes(
67-
service_info.raw
68-
)
69-
else:
70-
changed_manufacturer_data = self.changed_manufacturer_data(service_info)
63+
changed_manufacturer_data = self.changed_manufacturer_data(service_info)
7164

7265
if not changed_manufacturer_data or len(changed_manufacturer_data) > 1:
7366
# If len(changed_manufacturer_data) > 1 it means we switched

0 commit comments

Comments
 (0)