Skip to content

Commit 2f47c2d

Browse files
authored
feat: use changed_manufacturer_data from newer bluetooth-sensor-state-data (#36)
1 parent a74525e commit 2f47c2d

File tree

3 files changed

+56
-77
lines changed

3 files changed

+56
-77
lines changed

poetry.lock

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

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ packages = [
2323
"Changelog" = "https://github.com/bluetooth-devices/sensorpro-ble/blob/main/CHANGELOG.md"
2424

2525
[tool.poetry.dependencies]
26-
python = ">=3.11,<4"
26+
python = ">=3.11,<3.14"
2727
habluetooth = {version = ">=3.42.0", python = ">=3.11,<3.14"}
2828
bluetooth-data-tools = ">=1.28.0"
2929

@@ -32,7 +32,7 @@ Sphinx = {version = ">=5,<7", optional = true}
3232
sphinx-rtd-theme = {version = ">=1,<3", optional = true}
3333
myst-parser = {version = ">=0.18,<1.1", optional = true}
3434
sensor-state-data = ">=2.6.0"
35-
bluetooth-sensor-state-data = ">=1.6.1"
35+
bluetooth-sensor-state-data = ">=1.8.0"
3636

3737
[tool.poetry.extras]
3838
docs = [

src/sensorpro_ble/parser.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import logging
1212
from struct import unpack
1313

14-
from bluetooth_data_tools import parse_advertisement_data_bytes, short_address
14+
from bluetooth_data_tools import short_address
1515
from bluetooth_sensor_state_data import BluetoothData
1616
from habluetooth import BluetoothServiceInfoBleak
1717
from sensor_state_data import SensorLibrary
@@ -33,14 +33,7 @@ class SensorProBluetoothDeviceData(BluetoothData):
3333
def _start_update(self, service_info: BluetoothServiceInfoBleak) -> None:
3434
"""Update from BLE advertisement data."""
3535
_LOGGER.debug("Parsing sensorpro BLE advertisement data: %s", service_info)
36-
if service_info.raw:
37-
# If we have the raw data we don't need to work out
38-
# which one is the newest.
39-
_, _, _, changed_manufacturer_data, _ = parse_advertisement_data_bytes(
40-
service_info.raw
41-
)
42-
else:
43-
changed_manufacturer_data = self.changed_manufacturer_data(service_info)
36+
changed_manufacturer_data = self.changed_manufacturer_data(service_info)
4437
if 43605 not in changed_manufacturer_data:
4538
return
4639
if not changed_manufacturer_data or len(changed_manufacturer_data) > 1:

0 commit comments

Comments
 (0)