From afc1d224a05080d15f482d247ebc288892cf39de Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 28 Apr 2025 01:34:34 -0500 Subject: [PATCH] Bump sensorpro-ble to 0.6.0 (#143796) * Bump sensorpro-ble to 0.6.0 changelog: https://github.com/Bluetooth-Devices/sensorpro-ble/compare/v0.5.3...v0.6.0 * update tests --- .../components/sensorpro/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/sensorpro/__init__.py | 46 +++++++++++++++++-- 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/sensorpro/manifest.json b/homeassistant/components/sensorpro/manifest.json index ae3229e24c1..d6883c66653 100644 --- a/homeassistant/components/sensorpro/manifest.json +++ b/homeassistant/components/sensorpro/manifest.json @@ -18,5 +18,5 @@ "dependencies": ["bluetooth_adapters"], "documentation": "https://www.home-assistant.io/integrations/sensorpro", "iot_class": "local_push", - "requirements": ["sensorpro-ble==0.5.3"] + "requirements": ["sensorpro-ble==0.6.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index f71e0a7d669..53c37e3580a 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2719,7 +2719,7 @@ sense-energy==0.13.7 sensirion-ble==0.1.1 # homeassistant.components.sensorpro -sensorpro-ble==0.5.3 +sensorpro-ble==0.6.0 # homeassistant.components.sensorpush_cloud sensorpush-api==2.1.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 11c1203fd16..268668d2810 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2199,7 +2199,7 @@ sense-energy==0.13.7 sensirion-ble==0.1.1 # homeassistant.components.sensorpro -sensorpro-ble==0.5.3 +sensorpro-ble==0.6.0 # homeassistant.components.sensorpush_cloud sensorpush-api==2.1.2 diff --git a/tests/components/sensorpro/__init__.py b/tests/components/sensorpro/__init__.py index da40ff9a3f7..a63bdbe08dc 100644 --- a/tests/components/sensorpro/__init__.py +++ b/tests/components/sensorpro/__init__.py @@ -1,8 +1,48 @@ """Tests for the SensorPro integration.""" -from homeassistant.helpers.service_info.bluetooth import BluetoothServiceInfo +from uuid import UUID -NOT_SENSORPRO_SERVICE_INFO = BluetoothServiceInfo( +from bleak.backends.device import BLEDevice +from bluetooth_data_tools import monotonic_time_coarse + +from homeassistant.components.bluetooth import BluetoothServiceInfoBleak + + +def make_bluetooth_service_info( + name: str, + manufacturer_data: dict[int, bytes], + service_uuids: list[str], + address: str, + rssi: int, + service_data: dict[UUID, bytes], + source: str, + tx_power: int = 0, + raw: bytes | None = None, +) -> BluetoothServiceInfoBleak: + """Create a BluetoothServiceInfoBleak object for testing.""" + return BluetoothServiceInfoBleak( + name=name, + manufacturer_data=manufacturer_data, + service_uuids=service_uuids, + address=address, + rssi=rssi, + service_data=service_data, + source=source, + device=BLEDevice( + name=name, + address=address, + details={}, + rssi=rssi, + ), + time=monotonic_time_coarse(), + advertisement=None, + connectable=True, + tx_power=tx_power, + raw=raw, + ) + + +NOT_SENSORPRO_SERVICE_INFO = make_bluetooth_service_info( name="Not it", address="61DE521B-F0BF-9F44-64D4-75BBE1738105", rssi=-63, @@ -12,7 +52,7 @@ NOT_SENSORPRO_SERVICE_INFO = BluetoothServiceInfo( source="local", ) -SENSORPRO_SERVICE_INFO = BluetoothServiceInfo( +SENSORPRO_SERVICE_INFO = make_bluetooth_service_info( name="T201", address="aa:bb:cc:dd:ee:ff", rssi=-60,