Skip to content

Commit 64bed19

Browse files
authored
Bump bosch-alarm-mode2 to v0.4.10 (home-assistant#157564)
1 parent 6357067 commit 64bed19

File tree

11 files changed

+41
-34
lines changed

11 files changed

+41
-34
lines changed

homeassistant/components/bosch_alarm/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: BoschAlarmConfigEntry) -
6868
config_entry_id=entry.entry_id,
6969
connections={(CONNECTION_NETWORK_MAC, mac)} if mac else set(),
7070
identifiers={(DOMAIN, entry.unique_id or entry.entry_id)},
71-
name=f"Bosch {panel.model}",
71+
name=f"Bosch {panel.model.name}",
7272
manufacturer="Bosch Security Systems",
73-
model=panel.model,
73+
model=panel.model.name,
7474
sw_version=panel.firmware_version,
7575
)
7676
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

homeassistant/components/bosch_alarm/config_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def try_connect(
8383
finally:
8484
await panel.disconnect()
8585

86-
return (panel.model, panel.serial_number)
86+
return (panel.model.name, panel.serial_number)
8787

8888

8989
class BoschAlarmConfigFlow(ConfigFlow, domain=DOMAIN):

homeassistant/components/bosch_alarm/diagnostics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ async def async_get_config_entry_diagnostics(
2020
return {
2121
"entry_data": async_redact_data(entry.data, TO_REDACT),
2222
"data": {
23-
"model": entry.runtime_data.model,
23+
"model": entry.runtime_data.model.name,
24+
"family": entry.runtime_data.model.family.name,
2425
"serial_number": entry.runtime_data.serial_number,
2526
"protocol_version": entry.runtime_data.protocol_version,
2627
"firmware_version": entry.runtime_data.firmware_version,

homeassistant/components/bosch_alarm/entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
self._attr_should_poll = False
2727
self._attr_device_info = DeviceInfo(
2828
identifiers={(DOMAIN, unique_id)},
29-
name=f"Bosch {panel.model}",
29+
name=f"Bosch {panel.model.name}",
3030
manufacturer="Bosch Security Systems",
3131
)
3232

homeassistant/components/bosch_alarm/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"integration_type": "device",
1313
"iot_class": "local_push",
1414
"quality_scale": "platinum",
15-
"requirements": ["bosch-alarm-mode2==0.4.6"]
15+
"requirements": ["bosch-alarm-mode2==0.4.10"]
1616
}

requirements_all.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements_test_all.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/components/bosch_alarm/conftest.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Any
55
from unittest.mock import AsyncMock, patch
66

7+
from bosch_alarm_mode2.const import PANEL_FAMILY, PanelModel
78
from bosch_alarm_mode2.panel import Area, Door, Output, Point
89
from bosch_alarm_mode2.utils import Observable
910
import pytest
@@ -39,10 +40,10 @@ def model(request: pytest.FixtureRequest) -> Generator[str]:
3940

4041
@pytest.fixture
4142
def extra_config_entry_data(
42-
model: str, model_name: str, config_flow_data: dict[str, Any]
43+
model: str, panel_model: PanelModel, config_flow_data: dict[str, Any]
4344
) -> dict[str, Any]:
4445
"""Return extra config entry data."""
45-
return {CONF_MODEL: model_name} | config_flow_data
46+
return {CONF_MODEL: panel_model.name} | config_flow_data
4647

4748

4849
@pytest.fixture(params=[None])
@@ -64,12 +65,12 @@ def config_flow_data(model: str) -> dict[str, Any]:
6465

6566

6667
@pytest.fixture
67-
def model_name(model: str) -> str | None:
68+
def panel_model(model: str) -> PanelModel | None:
6869
"""Return extra config entry data."""
6970
return {
70-
"solution_3000": "Solution 3000",
71-
"amax_3000": "AMAX 3000",
72-
"b5512": "B5512 (US1B)",
71+
"solution_3000": PanelModel("Solution 3000", PANEL_FAMILY.SOLUTION),
72+
"amax_3000": PanelModel("AMAX 3000", PANEL_FAMILY.AMAX),
73+
"b5512": PanelModel("B5512 (US1B)", PANEL_FAMILY.BG_SERIES),
7374
}.get(model)
7475

7576

@@ -166,7 +167,7 @@ def mock_panel(
166167
door: AsyncMock,
167168
output: AsyncMock,
168169
points: dict[int, AsyncMock],
169-
model_name: str,
170+
panel_model: str,
170171
serial_number: str | None,
171172
) -> Generator[AsyncMock]:
172173
"""Define a fixture to set up Bosch Alarm."""
@@ -181,7 +182,7 @@ def mock_panel(
181182
client.doors = {1: door}
182183
client.outputs = {1: output}
183184
client.points = points
184-
client.model = model_name
185+
client.model = panel_model
185186
client.faults = []
186187
client.events = []
187188
client.panel_faults_ids = []

tests/components/bosch_alarm/snapshots/test_diagnostics.ambr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
'open': False,
2929
}),
3030
]),
31+
'family': 'AMAX',
3132
'firmware_version': '1.0.0',
3233
'history_events': list([
3334
]),
@@ -124,6 +125,7 @@
124125
'open': False,
125126
}),
126127
]),
128+
'family': 'BG_SERIES',
127129
'firmware_version': '1.0.0',
128130
'history_events': list([
129131
]),
@@ -219,6 +221,7 @@
219221
'open': False,
220222
}),
221223
]),
224+
'family': 'SOLUTION',
222225
'firmware_version': '1.0.0',
223226
'history_events': list([
224227
]),

tests/components/bosch_alarm/test_config_flow.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Any
55
from unittest.mock import AsyncMock
66

7+
from bosch_alarm_mode2.const import PANEL_FAMILY, PanelModel
78
import pytest
89

910
from homeassistant.components.bosch_alarm.const import DOMAIN
@@ -22,7 +23,7 @@ async def test_form_user(
2223
hass: HomeAssistant,
2324
mock_setup_entry: AsyncMock,
2425
mock_panel: AsyncMock,
25-
model_name: str,
26+
panel_model: PanelModel,
2627
serial_number: str,
2728
config_flow_data: dict[str, Any],
2829
) -> None:
@@ -45,13 +46,13 @@ async def test_form_user(
4546
config_flow_data,
4647
)
4748
assert result["type"] is FlowResultType.CREATE_ENTRY
48-
assert result["title"] == f"Bosch {model_name}"
49+
assert result["title"] == f"Bosch {panel_model.name}"
4950
assert (
5051
result["data"]
5152
== {
5253
CONF_HOST: "1.1.1.1",
5354
CONF_PORT: 7700,
54-
CONF_MODEL: model_name,
55+
CONF_MODEL: panel_model.name,
5556
}
5657
| config_flow_data
5758
)
@@ -211,7 +212,7 @@ async def test_dhcp_can_finish(
211212
hass: HomeAssistant,
212213
mock_setup_entry: AsyncMock,
213214
mock_panel: AsyncMock,
214-
model_name: str,
215+
panel_model: PanelModel,
215216
serial_number: str,
216217
config_flow_data: dict[str, Any],
217218
) -> None:
@@ -237,12 +238,12 @@ async def test_dhcp_can_finish(
237238
await hass.async_block_till_done()
238239

239240
assert result["type"] is FlowResultType.CREATE_ENTRY
240-
assert result["title"] == f"Bosch {model_name}"
241+
assert result["title"] == f"Bosch {panel_model.name}"
241242
assert result["data"] == {
242243
CONF_HOST: "1.1.1.1",
243244
CONF_MAC: "34:ea:34:b4:3b:5a",
244245
CONF_PORT: 7700,
245-
CONF_MODEL: model_name,
246+
CONF_MODEL: panel_model.name,
246247
**config_flow_data,
247248
}
248249

@@ -258,7 +259,7 @@ async def test_dhcp_exceptions(
258259
hass: HomeAssistant,
259260
mock_setup_entry: AsyncMock,
260261
mock_panel: AsyncMock,
261-
model_name: str,
262+
panel_model: PanelModel,
262263
serial_number: str,
263264
config_flow_data: dict[str, Any],
264265
exception: Exception,
@@ -316,7 +317,7 @@ async def test_dhcp_discovery_if_panel_setup_config_flow(
316317
mock_config_entry: MockConfigEntry,
317318
mock_panel: AsyncMock,
318319
serial_number: str,
319-
model_name: str,
320+
panel_model: PanelModel,
320321
config_flow_data: dict[str, Any],
321322
) -> None:
322323
"""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(
346347
await hass.async_block_till_done()
347348

348349
assert result["type"] is FlowResultType.CREATE_ENTRY
349-
assert result["title"] == f"Bosch {model_name}"
350+
assert result["title"] == f"Bosch {panel_model.name}"
350351
assert result["data"] == {
351352
CONF_HOST: "4.5.6.7",
352353
CONF_MAC: "34:ea:34:b4:3b:5a",
353354
CONF_PORT: 7700,
354-
CONF_MODEL: model_name,
355+
CONF_MODEL: panel_model.name,
355356
**config_flow_data,
356357
}
357358
assert mock_config_entry.unique_id == serial_number
@@ -395,7 +396,7 @@ async def test_dhcp_updates_mac(
395396
mock_setup_entry: AsyncMock,
396397
mock_config_entry: MockConfigEntry,
397398
mock_panel: AsyncMock,
398-
model_name: str,
399+
panel_model: PanelModel,
399400
serial_number: str,
400401
config_flow_data: dict[str, Any],
401402
) -> None:
@@ -424,7 +425,7 @@ async def test_reauth_flow_success(
424425
mock_setup_entry: AsyncMock,
425426
mock_config_entry: MockConfigEntry,
426427
mock_panel: AsyncMock,
427-
model_name: str,
428+
panel_model: PanelModel,
428429
serial_number: str,
429430
config_flow_data: dict[str, Any],
430431
) -> None:
@@ -459,7 +460,7 @@ async def test_reauth_flow_error(
459460
mock_setup_entry: AsyncMock,
460461
mock_config_entry: MockConfigEntry,
461462
mock_panel: AsyncMock,
462-
model_name: str,
463+
panel_model: PanelModel,
463464
serial_number: str,
464465
config_flow_data: dict[str, Any],
465466
exception: Exception,
@@ -494,7 +495,7 @@ async def test_reconfig_flow(
494495
mock_setup_entry: AsyncMock,
495496
mock_config_entry: MockConfigEntry,
496497
mock_panel: AsyncMock,
497-
model_name: str,
498+
panel_model: PanelModel,
498499
serial_number: str,
499500
config_flow_data: dict[str, Any],
500501
) -> None:
@@ -529,7 +530,7 @@ async def test_reconfig_flow(
529530
assert mock_config_entry.data == {
530531
CONF_HOST: "1.1.1.1",
531532
CONF_PORT: 7700,
532-
CONF_MODEL: model_name,
533+
CONF_MODEL: panel_model.name,
533534
**config_flow_data,
534535
}
535536

@@ -540,7 +541,7 @@ async def test_reconfig_flow_incorrect_model(
540541
mock_setup_entry: AsyncMock,
541542
mock_config_entry: MockConfigEntry,
542543
mock_panel: AsyncMock,
543-
model_name: str,
544+
panel_model: PanelModel,
544545
serial_number: str,
545546
config_flow_data: dict[str, Any],
546547
) -> None:
@@ -556,7 +557,7 @@ async def test_reconfig_flow_incorrect_model(
556557
},
557558
)
558559

559-
mock_panel.model = "Solution 3000"
560+
mock_panel.model = PanelModel("Solution 3000", family=PANEL_FAMILY.SOLUTION)
560561

561562
assert result["type"] is FlowResultType.FORM
562563
assert result["step_id"] == "user"

0 commit comments

Comments
 (0)