From 64bed198052e2bc9c6f93467a17b5ca4fa1ae897 Mon Sep 17 00:00:00 2001 From: Sanjay Govind Date: Mon, 1 Dec 2025 04:02:43 +1300 Subject: [PATCH] Bump bosch-alarm-mode2 to v0.4.10 (#157564) --- .../components/bosch_alarm/__init__.py | 4 +-- .../components/bosch_alarm/config_flow.py | 2 +- .../components/bosch_alarm/diagnostics.py | 3 +- .../components/bosch_alarm/entity.py | 2 +- .../components/bosch_alarm/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/bosch_alarm/conftest.py | 17 ++++----- .../snapshots/test_diagnostics.ambr | 3 ++ .../bosch_alarm/test_config_flow.py | 35 ++++++++++--------- .../bosch_alarm/test_diagnostics.py | 3 +- 11 files changed, 41 insertions(+), 34 deletions(-) diff --git a/homeassistant/components/bosch_alarm/__init__.py b/homeassistant/components/bosch_alarm/__init__.py index c442c921a6b..f25dedb20bd 100644 --- a/homeassistant/components/bosch_alarm/__init__.py +++ b/homeassistant/components/bosch_alarm/__init__.py @@ -68,9 +68,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: BoschAlarmConfigEntry) - config_entry_id=entry.entry_id, connections={(CONNECTION_NETWORK_MAC, mac)} if mac else set(), identifiers={(DOMAIN, entry.unique_id or entry.entry_id)}, - name=f"Bosch {panel.model}", + name=f"Bosch {panel.model.name}", manufacturer="Bosch Security Systems", - model=panel.model, + model=panel.model.name, sw_version=panel.firmware_version, ) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) diff --git a/homeassistant/components/bosch_alarm/config_flow.py b/homeassistant/components/bosch_alarm/config_flow.py index e492e2e7c14..7b3f549c91d 100644 --- a/homeassistant/components/bosch_alarm/config_flow.py +++ b/homeassistant/components/bosch_alarm/config_flow.py @@ -83,7 +83,7 @@ async def try_connect( finally: await panel.disconnect() - return (panel.model, panel.serial_number) + return (panel.model.name, panel.serial_number) class BoschAlarmConfigFlow(ConfigFlow, domain=DOMAIN): diff --git a/homeassistant/components/bosch_alarm/diagnostics.py b/homeassistant/components/bosch_alarm/diagnostics.py index ea9988960b5..2232e7f8d85 100644 --- a/homeassistant/components/bosch_alarm/diagnostics.py +++ b/homeassistant/components/bosch_alarm/diagnostics.py @@ -20,7 +20,8 @@ async def async_get_config_entry_diagnostics( return { "entry_data": async_redact_data(entry.data, TO_REDACT), "data": { - "model": entry.runtime_data.model, + "model": entry.runtime_data.model.name, + "family": entry.runtime_data.model.family.name, "serial_number": entry.runtime_data.serial_number, "protocol_version": entry.runtime_data.protocol_version, "firmware_version": entry.runtime_data.firmware_version, diff --git a/homeassistant/components/bosch_alarm/entity.py b/homeassistant/components/bosch_alarm/entity.py index 537ee412e47..6fe624e8901 100644 --- a/homeassistant/components/bosch_alarm/entity.py +++ b/homeassistant/components/bosch_alarm/entity.py @@ -26,7 +26,7 @@ class BoschAlarmEntity(Entity): self._attr_should_poll = False self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, unique_id)}, - name=f"Bosch {panel.model}", + name=f"Bosch {panel.model.name}", manufacturer="Bosch Security Systems", ) diff --git a/homeassistant/components/bosch_alarm/manifest.json b/homeassistant/components/bosch_alarm/manifest.json index 0003d80cc4f..d848259c572 100644 --- a/homeassistant/components/bosch_alarm/manifest.json +++ b/homeassistant/components/bosch_alarm/manifest.json @@ -12,5 +12,5 @@ "integration_type": "device", "iot_class": "local_push", "quality_scale": "platinum", - "requirements": ["bosch-alarm-mode2==0.4.6"] + "requirements": ["bosch-alarm-mode2==0.4.10"] } diff --git a/requirements_all.txt b/requirements_all.txt index 73d7277a139..29888bedd56 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -675,7 +675,7 @@ bluetooth-data-tools==1.28.4 bond-async==0.2.1 # homeassistant.components.bosch_alarm -bosch-alarm-mode2==0.4.6 +bosch-alarm-mode2==0.4.10 # homeassistant.components.bosch_shc boschshcpy==0.2.107 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index d39936c3594..6dcb49ac87e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -609,7 +609,7 @@ bluetooth-data-tools==1.28.4 bond-async==0.2.1 # homeassistant.components.bosch_alarm -bosch-alarm-mode2==0.4.6 +bosch-alarm-mode2==0.4.10 # homeassistant.components.bosch_shc boschshcpy==0.2.107 diff --git a/tests/components/bosch_alarm/conftest.py b/tests/components/bosch_alarm/conftest.py index 01b6252229a..0d0f735aef6 100644 --- a/tests/components/bosch_alarm/conftest.py +++ b/tests/components/bosch_alarm/conftest.py @@ -4,6 +4,7 @@ from collections.abc import Generator from typing import Any from unittest.mock import AsyncMock, patch +from bosch_alarm_mode2.const import PANEL_FAMILY, PanelModel from bosch_alarm_mode2.panel import Area, Door, Output, Point from bosch_alarm_mode2.utils import Observable import pytest @@ -39,10 +40,10 @@ def model(request: pytest.FixtureRequest) -> Generator[str]: @pytest.fixture def extra_config_entry_data( - model: str, model_name: str, config_flow_data: dict[str, Any] + model: str, panel_model: PanelModel, config_flow_data: dict[str, Any] ) -> dict[str, Any]: """Return extra config entry data.""" - return {CONF_MODEL: model_name} | config_flow_data + return {CONF_MODEL: panel_model.name} | config_flow_data @pytest.fixture(params=[None]) @@ -64,12 +65,12 @@ def config_flow_data(model: str) -> dict[str, Any]: @pytest.fixture -def model_name(model: str) -> str | None: +def panel_model(model: str) -> PanelModel | None: """Return extra config entry data.""" return { - "solution_3000": "Solution 3000", - "amax_3000": "AMAX 3000", - "b5512": "B5512 (US1B)", + "solution_3000": PanelModel("Solution 3000", PANEL_FAMILY.SOLUTION), + "amax_3000": PanelModel("AMAX 3000", PANEL_FAMILY.AMAX), + "b5512": PanelModel("B5512 (US1B)", PANEL_FAMILY.BG_SERIES), }.get(model) @@ -166,7 +167,7 @@ def mock_panel( door: AsyncMock, output: AsyncMock, points: dict[int, AsyncMock], - model_name: str, + panel_model: str, serial_number: str | None, ) -> Generator[AsyncMock]: """Define a fixture to set up Bosch Alarm.""" @@ -181,7 +182,7 @@ def mock_panel( client.doors = {1: door} client.outputs = {1: output} client.points = points - client.model = model_name + client.model = panel_model client.faults = [] client.events = [] client.panel_faults_ids = [] diff --git a/tests/components/bosch_alarm/snapshots/test_diagnostics.ambr b/tests/components/bosch_alarm/snapshots/test_diagnostics.ambr index ad8b7cfbc38..c3ed5ea1c6e 100644 --- a/tests/components/bosch_alarm/snapshots/test_diagnostics.ambr +++ b/tests/components/bosch_alarm/snapshots/test_diagnostics.ambr @@ -28,6 +28,7 @@ 'open': False, }), ]), + 'family': 'AMAX', 'firmware_version': '1.0.0', 'history_events': list([ ]), @@ -124,6 +125,7 @@ 'open': False, }), ]), + 'family': 'BG_SERIES', 'firmware_version': '1.0.0', 'history_events': list([ ]), @@ -219,6 +221,7 @@ 'open': False, }), ]), + 'family': 'SOLUTION', 'firmware_version': '1.0.0', 'history_events': list([ ]), diff --git a/tests/components/bosch_alarm/test_config_flow.py b/tests/components/bosch_alarm/test_config_flow.py index d39bff935d5..388b2ed0bd6 100644 --- a/tests/components/bosch_alarm/test_config_flow.py +++ b/tests/components/bosch_alarm/test_config_flow.py @@ -4,6 +4,7 @@ import asyncio from typing import Any from unittest.mock import AsyncMock +from bosch_alarm_mode2.const import PANEL_FAMILY, PanelModel import pytest from homeassistant.components.bosch_alarm.const import DOMAIN @@ -22,7 +23,7 @@ async def test_form_user( hass: HomeAssistant, mock_setup_entry: AsyncMock, mock_panel: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, config_flow_data: dict[str, Any], ) -> None: @@ -45,13 +46,13 @@ async def test_form_user( config_flow_data, ) assert result["type"] is FlowResultType.CREATE_ENTRY - assert result["title"] == f"Bosch {model_name}" + assert result["title"] == f"Bosch {panel_model.name}" assert ( result["data"] == { CONF_HOST: "1.1.1.1", CONF_PORT: 7700, - CONF_MODEL: model_name, + CONF_MODEL: panel_model.name, } | config_flow_data ) @@ -211,7 +212,7 @@ async def test_dhcp_can_finish( hass: HomeAssistant, mock_setup_entry: AsyncMock, mock_panel: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, config_flow_data: dict[str, Any], ) -> None: @@ -237,12 +238,12 @@ async def test_dhcp_can_finish( await hass.async_block_till_done() assert result["type"] is FlowResultType.CREATE_ENTRY - assert result["title"] == f"Bosch {model_name}" + assert result["title"] == f"Bosch {panel_model.name}" assert result["data"] == { CONF_HOST: "1.1.1.1", CONF_MAC: "34:ea:34:b4:3b:5a", CONF_PORT: 7700, - CONF_MODEL: model_name, + CONF_MODEL: panel_model.name, **config_flow_data, } @@ -258,7 +259,7 @@ async def test_dhcp_exceptions( hass: HomeAssistant, mock_setup_entry: AsyncMock, mock_panel: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, config_flow_data: dict[str, Any], exception: Exception, @@ -316,7 +317,7 @@ async def test_dhcp_discovery_if_panel_setup_config_flow( mock_config_entry: MockConfigEntry, mock_panel: AsyncMock, serial_number: str, - model_name: str, + panel_model: PanelModel, config_flow_data: dict[str, Any], ) -> None: """Test DHCP discovery doesn't fail if a different panel was set up via config flow.""" @@ -346,12 +347,12 @@ async def test_dhcp_discovery_if_panel_setup_config_flow( await hass.async_block_till_done() assert result["type"] is FlowResultType.CREATE_ENTRY - assert result["title"] == f"Bosch {model_name}" + assert result["title"] == f"Bosch {panel_model.name}" assert result["data"] == { CONF_HOST: "4.5.6.7", CONF_MAC: "34:ea:34:b4:3b:5a", CONF_PORT: 7700, - CONF_MODEL: model_name, + CONF_MODEL: panel_model.name, **config_flow_data, } assert mock_config_entry.unique_id == serial_number @@ -395,7 +396,7 @@ async def test_dhcp_updates_mac( mock_setup_entry: AsyncMock, mock_config_entry: MockConfigEntry, mock_panel: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, config_flow_data: dict[str, Any], ) -> None: @@ -424,7 +425,7 @@ async def test_reauth_flow_success( mock_setup_entry: AsyncMock, mock_config_entry: MockConfigEntry, mock_panel: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, config_flow_data: dict[str, Any], ) -> None: @@ -459,7 +460,7 @@ async def test_reauth_flow_error( mock_setup_entry: AsyncMock, mock_config_entry: MockConfigEntry, mock_panel: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, config_flow_data: dict[str, Any], exception: Exception, @@ -494,7 +495,7 @@ async def test_reconfig_flow( mock_setup_entry: AsyncMock, mock_config_entry: MockConfigEntry, mock_panel: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, config_flow_data: dict[str, Any], ) -> None: @@ -529,7 +530,7 @@ async def test_reconfig_flow( assert mock_config_entry.data == { CONF_HOST: "1.1.1.1", CONF_PORT: 7700, - CONF_MODEL: model_name, + CONF_MODEL: panel_model.name, **config_flow_data, } @@ -540,7 +541,7 @@ async def test_reconfig_flow_incorrect_model( mock_setup_entry: AsyncMock, mock_config_entry: MockConfigEntry, mock_panel: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, config_flow_data: dict[str, Any], ) -> None: @@ -556,7 +557,7 @@ async def test_reconfig_flow_incorrect_model( }, ) - mock_panel.model = "Solution 3000" + mock_panel.model = PanelModel("Solution 3000", family=PANEL_FAMILY.SOLUTION) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" diff --git a/tests/components/bosch_alarm/test_diagnostics.py b/tests/components/bosch_alarm/test_diagnostics.py index 3e10878bd07..bb4e52a8937 100644 --- a/tests/components/bosch_alarm/test_diagnostics.py +++ b/tests/components/bosch_alarm/test_diagnostics.py @@ -3,6 +3,7 @@ from typing import Any from unittest.mock import AsyncMock +from bosch_alarm_mode2.const import PanelModel from syrupy.assertion import SnapshotAssertion from homeassistant.core import HomeAssistant @@ -19,7 +20,7 @@ async def test_diagnostics( hass_client: ClientSessionGenerator, mock_panel: AsyncMock, area: AsyncMock, - model_name: str, + panel_model: PanelModel, serial_number: str, snapshot: SnapshotAssertion, mock_config_entry: MockConfigEntry,