From 3caa4963bc5f80e28e5828e4ce72a34a7f82d7aa Mon Sep 17 00:00:00 2001 From: On Freund Date: Wed, 31 Aug 2022 06:48:03 +0300 Subject: [PATCH] Use partition name as device name in Risco alarm control panels (#77526) --- homeassistant/components/risco/alarm_control_panel.py | 2 +- tests/components/risco/test_alarm_control_panel.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/risco/alarm_control_panel.py b/homeassistant/components/risco/alarm_control_panel.py index 4196ee0cf42..79da100d6e1 100644 --- a/homeassistant/components/risco/alarm_control_panel.py +++ b/homeassistant/components/risco/alarm_control_panel.py @@ -235,7 +235,7 @@ class RiscoLocalAlarm(RiscoAlarm): self._attr_unique_id = f"{system_id}_{partition_id}_local" self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, self._attr_unique_id)}, - name=f"Risco {system_id} Partition {partition_id}", + name=partition.name, manufacturer="Risco", ) diff --git a/tests/components/risco/test_alarm_control_panel.py b/tests/components/risco/test_alarm_control_panel.py index ca0eb604eef..0014e712ab1 100644 --- a/tests/components/risco/test_alarm_control_panel.py +++ b/tests/components/risco/test_alarm_control_panel.py @@ -36,8 +36,8 @@ from .util import TEST_SITE_UUID FIRST_CLOUD_ENTITY_ID = "alarm_control_panel.risco_test_site_name_partition_0" SECOND_CLOUD_ENTITY_ID = "alarm_control_panel.risco_test_site_name_partition_1" -FIRST_LOCAL_ENTITY_ID = "alarm_control_panel.risco_test_site_uuid_partition_0" -SECOND_LOCAL_ENTITY_ID = "alarm_control_panel.risco_test_site_uuid_partition_1" +FIRST_LOCAL_ENTITY_ID = "alarm_control_panel.name_0" +SECOND_LOCAL_ENTITY_ID = "alarm_control_panel.name_1" CODES_REQUIRED_OPTIONS = {"code_arm_required": True, "code_disarm_required": True} TEST_RISCO_TO_HA = { @@ -112,8 +112,12 @@ def two_part_local_alarm(): partition_mocks = {0: _partition_mock(), 1: _partition_mock()} with patch.object( partition_mocks[0], "id", new_callable=PropertyMock(return_value=0) + ), patch.object( + partition_mocks[0], "name", new_callable=PropertyMock(return_value="Name 0") ), patch.object( partition_mocks[1], "id", new_callable=PropertyMock(return_value=1) + ), patch.object( + partition_mocks[1], "name", new_callable=PropertyMock(return_value="Name 1") ), patch( "homeassistant.components.risco.RiscoLocal.zones", new_callable=PropertyMock(return_value={}),