From 8fb6eb83acfcab39bddb617b69058781d477fdff Mon Sep 17 00:00:00 2001 From: Austin Brunkhorst Date: Mon, 9 Nov 2026 12:14:06 -0800 Subject: [PATCH] Add Bluetooth discovery for Snooz Breez devices (#190245) --- homeassistant/components/snooz/manifest.json | 3 +++ homeassistant/generated/bluetooth.py | 4 ++++ tests/components/snooz/__init__.py | 14 ++++++++++++++ tests/components/snooz/test_config_flow.py | 16 ++++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/homeassistant/components/snooz/manifest.json b/homeassistant/components/snooz/manifest.json index a69425399fc4..6feda64de7a4 100644 --- a/homeassistant/components/snooz/manifest.json +++ b/homeassistant/components/snooz/manifest.json @@ -2,6 +2,9 @@ "domain": "snooz", "name": "Snooz", "bluetooth": [ + { + "local_name": "Breez*" + }, { "local_name": "Snooz*" }, diff --git a/homeassistant/generated/bluetooth.py b/homeassistant/generated/bluetooth.py index 4f473b8ecbf4..eba99a6c16e8 100644 --- a/homeassistant/generated/bluetooth.py +++ b/homeassistant/generated/bluetooth.py @@ -1109,6 +1109,10 @@ BLUETOOTH: Final[list[dict[str, bool | str | int | list[int]]]] = [ "domain": "shelly", "manufacturer_id": 2985, }, + { + "domain": "snooz", + "local_name": "Breez*", + }, { "domain": "snooz", "local_name": "Snooz*", diff --git a/tests/components/snooz/__init__.py b/tests/components/snooz/__init__.py index 000e7071eaea..c3019dc105cf 100644 --- a/tests/components/snooz/__init__.py +++ b/tests/components/snooz/__init__.py @@ -31,6 +31,20 @@ NOT_SNOOZ_SERVICE_INFO = BluetoothServiceInfo( source="local", ) +TEST_BREEZ_ADDRESS = "00:00:00:00:0B:FA" +TEST_BREEZ_DISPLAY_NAME = "Breez 0BFA" + +# A Breez advertises its name and manufacturer data but no service UUIDs +BREEZ_SERVICE_INFO = BluetoothServiceInfo( + name="Breez-0BFA", + address=TEST_BREEZ_ADDRESS, + rssi=-63, + manufacturer_data={65552: bytes([0x14]) + bytes([0] * 8)}, + service_data={}, + service_uuids=[], + source="local", +) + SNOOZ_SERVICE_INFO_PAIRING = BluetoothServiceInfo( name=TEST_SNOOZ_LOCAL_NAME, address=TEST_ADDRESS, diff --git a/tests/components/snooz/test_config_flow.py b/tests/components/snooz/test_config_flow.py index c6a948c0dd61..5342529e23e9 100644 --- a/tests/components/snooz/test_config_flow.py +++ b/tests/components/snooz/test_config_flow.py @@ -4,6 +4,7 @@ from asyncio import Event, sleep from unittest.mock import patch from pytest_homeassistant.common import MockConfigEntry +from pytest_homeassistant.components.bluetooth import inject_bluetooth_service_info from homeassistant import config_entries from homeassistant.components.snooz.const import DOMAIN @@ -13,11 +14,13 @@ from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType from . import ( + BREEZ_SERVICE_INFO, NOT_SNOOZ_SERVICE_INFO, SNOOZ_SERVICE_INFO_CHARACTERISTIC_NAME, SNOOZ_SERVICE_INFO_NOT_PAIRING, SNOOZ_SERVICE_INFO_PAIRING, TEST_ADDRESS, + TEST_BREEZ_DISPLAY_NAME, TEST_PAIRING_TOKEN, TEST_SNOOZ_DISPLAY_NAME, ) @@ -89,6 +92,19 @@ async def test_async_step_bluetooth_not_snooz(hass: HomeAssistant) -> None: assert result["reason"] == "not_supported" +async def test_async_step_bluetooth_breez(hass: HomeAssistant) -> None: + """Test a Breez advertisement matches and starts a discovery flow.""" + inject_bluetooth_service_info(hass, BREEZ_SERVICE_INFO) + await hass.async_block_till_done(wait_background_tasks=True) + + flows = hass.config_entries.flow.async_progress_by_handler(DOMAIN) + assert len(flows) == 1 + assert flows[0]["step_id"] == "bluetooth_confirm" + assert flows[0]["context"]["title_placeholders"] == { + "name": TEST_BREEZ_DISPLAY_NAME + } + + async def test_async_step_user_no_devices_found(hass: HomeAssistant) -> None: """Test setup from service info cache with no devices found.""" result = await hass.config_entries.flow.async_init(