Use partition name as device name in Risco alarm control panels (#77526)

pull/77586/head
On Freund 2022-08-31 06:48:03 +03:00 committed by GitHub
parent 4185a70882
commit 3caa4963bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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",
)

View File

@ -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={}),