From 2abb9148674a4d765eb34a164c3e5ec84c20ae4f Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 27 Aug 2025 10:36:42 +0200 Subject: [PATCH] Update husqvarna_automower_ble bluetooth discovery checks (#151225) --- .../components/husqvarna_automower_ble/config_flow.py | 6 +----- tests/components/husqvarna_automower_ble/__init__.py | 3 --- .../husqvarna_automower_ble/test_config_flow.py | 8 +++++--- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/husqvarna_automower_ble/config_flow.py b/homeassistant/components/husqvarna_automower_ble/config_flow.py index 15de6bde708..c8f1cfaf630 100644 --- a/homeassistant/components/husqvarna_automower_ble/config_flow.py +++ b/homeassistant/components/husqvarna_automower_ble/config_flow.py @@ -34,12 +34,8 @@ def _is_supported(discovery_info: BluetoothServiceInfo): service == "98bd0001-0b0e-421a-84e5-ddbf75dc6de4" for service in discovery_info.service_uuids ) - service_generic = any( - service == "00001800-0000-1000-8000-00805f9b34fb" - for service in discovery_info.service_uuids - ) - return manufacturer and service_husqvarna and service_generic + return manufacturer and service_husqvarna def _pin_valid(pin: str) -> bool: diff --git a/tests/components/husqvarna_automower_ble/__init__.py b/tests/components/husqvarna_automower_ble/__init__.py index 7ca5aea121d..841b6f65516 100644 --- a/tests/components/husqvarna_automower_ble/__init__.py +++ b/tests/components/husqvarna_automower_ble/__init__.py @@ -17,7 +17,6 @@ AUTOMOWER_SERVICE_INFO = BluetoothServiceInfo( manufacturer_data={1062: b"\x05\x04\xbf\xcf\xbb\r"}, service_uuids=[ "98bd0001-0b0e-421a-84e5-ddbf75dc6de4", - "00001800-0000-1000-8000-00805f9b34fb", ], source="local", ) @@ -30,7 +29,6 @@ AUTOMOWER_UNNAMED_SERVICE_INFO = BluetoothServiceInfo( manufacturer_data={1062: b"\x05\x04\xbf\xcf\xbb\r"}, service_uuids=[ "98bd0001-0b0e-421a-84e5-ddbf75dc6de4", - "00001800-0000-1000-8000-00805f9b34fb", ], source="local", ) @@ -43,7 +41,6 @@ AUTOMOWER_MISSING_MANUFACTURER_DATA_SERVICE_INFO = BluetoothServiceInfo( manufacturer_data={}, service_uuids=[ "98bd0001-0b0e-421a-84e5-ddbf75dc6de4", - "00001800-0000-1000-8000-00805f9b34fb", ], source="local", ) diff --git a/tests/components/husqvarna_automower_ble/test_config_flow.py b/tests/components/husqvarna_automower_ble/test_config_flow.py index 41dfdffae73..7b47063975e 100644 --- a/tests/components/husqvarna_automower_ble/test_config_flow.py +++ b/tests/components/husqvarna_automower_ble/test_config_flow.py @@ -13,9 +13,9 @@ from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType from . import ( + AUTOMOWER_MISSING_MANUFACTURER_DATA_SERVICE_INFO, AUTOMOWER_SERVICE_INFO, AUTOMOWER_UNNAMED_SERVICE_INFO, - AUTOMOWER_UNSUPPORTED_GROUP_SERVICE_INFO, ) from tests.common import MockConfigEntry @@ -277,13 +277,15 @@ async def test_bluetooth_not_paired( async def test_bluetooth_invalid(hass: HomeAssistant) -> None: """Test bluetooth device discovery with invalid data.""" - inject_bluetooth_service_info(hass, AUTOMOWER_UNSUPPORTED_GROUP_SERVICE_INFO) + inject_bluetooth_service_info( + hass, AUTOMOWER_MISSING_MANUFACTURER_DATA_SERVICE_INFO + ) await hass.async_block_till_done(wait_background_tasks=True) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_BLUETOOTH}, - data=AUTOMOWER_UNSUPPORTED_GROUP_SERVICE_INFO, + data=AUTOMOWER_MISSING_MANUFACTURER_DATA_SERVICE_INFO, ) assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_devices_found"