From 2a6b79ec0f404afaa0743bb2bcac1ca5be81117b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 28 Apr 2025 01:35:22 -0500 Subject: [PATCH] Bump bluemaestro-ble to 0.3.0 (#143795) * Bump bluemaestro-ble to 0.3.0 changelog: https://github.com/Bluetooth-Devices/bluemaestro-ble/compare/v0.2.3...v0.3.0 * update tests --- .../components/bluemaestro/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/bluemaestro/__init__.py | 46 +++++++++++++++++-- 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/bluemaestro/manifest.json b/homeassistant/components/bluemaestro/manifest.json index 8d2ff3b96f9..336945a3ca2 100644 --- a/homeassistant/components/bluemaestro/manifest.json +++ b/homeassistant/components/bluemaestro/manifest.json @@ -12,5 +12,5 @@ "dependencies": ["bluetooth_adapters"], "documentation": "https://www.home-assistant.io/integrations/bluemaestro", "iot_class": "local_push", - "requirements": ["bluemaestro-ble==0.2.3"] + "requirements": ["bluemaestro-ble==0.3.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index 53c37e3580a..2cdc8d22ea7 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -628,7 +628,7 @@ blockchain==1.4.4 bluecurrent-api==1.2.3 # homeassistant.components.bluemaestro -bluemaestro-ble==0.2.3 +bluemaestro-ble==0.3.0 # homeassistant.components.decora # bluepy==1.3.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 268668d2810..0e203aafde5 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -556,7 +556,7 @@ blinkpy==0.23.0 bluecurrent-api==1.2.3 # homeassistant.components.bluemaestro -bluemaestro-ble==0.2.3 +bluemaestro-ble==0.3.0 # homeassistant.components.bluetooth bluetooth-adapters==0.21.4 diff --git a/tests/components/bluemaestro/__init__.py b/tests/components/bluemaestro/__init__.py index 412bc3cb7b3..e598eb34597 100644 --- a/tests/components/bluemaestro/__init__.py +++ b/tests/components/bluemaestro/__init__.py @@ -1,8 +1,48 @@ """Tests for the BlueMaestro integration.""" -from homeassistant.helpers.service_info.bluetooth import BluetoothServiceInfo +from uuid import UUID -NOT_BLUEMAESTRO_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_BLUEMAESTRO_SERVICE_INFO = make_bluetooth_service_info( name="Not it", address="61DE521B-F0BF-9F44-64D4-75BBE1738105", rssi=-63, @@ -12,7 +52,7 @@ NOT_BLUEMAESTRO_SERVICE_INFO = BluetoothServiceInfo( source="local", ) -BLUEMAESTRO_SERVICE_INFO = BluetoothServiceInfo( +BLUEMAESTRO_SERVICE_INFO = make_bluetooth_service_info( name="FA17B62C", manufacturer_data={ 307: b"\x17d\x0e\x10\x00\x02\x00\xf2\x01\xf2\x00\x83\x01\x00\x01\r\x02\xab\x00\xf2\x01\xf2\x01\r\x02\xab\x00\xf2\x01\xf2\x00\xff\x02N\x00\x00\x00\x00\x00"