From 344f349371d593652fef0fcdfc47932be7b3501b Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 18 Jul 2023 20:41:14 +0200 Subject: [PATCH] Migrate Agent DVR to has entity name (#96562) --- homeassistant/components/agent_dvr/alarm_control_panel.py | 4 +++- homeassistant/components/agent_dvr/camera.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/agent_dvr/alarm_control_panel.py b/homeassistant/components/agent_dvr/alarm_control_panel.py index 632b2e29d57..dc8038862c6 100644 --- a/homeassistant/components/agent_dvr/alarm_control_panel.py +++ b/homeassistant/components/agent_dvr/alarm_control_panel.py @@ -47,14 +47,16 @@ class AgentBaseStation(AlarmControlPanelEntity): | AlarmControlPanelEntityFeature.ARM_AWAY | AlarmControlPanelEntityFeature.ARM_NIGHT ) + _attr_has_entity_name = True + _attr_name = None def __init__(self, client): """Initialize the alarm control panel.""" self._client = client - self._attr_name = f"{client.name} {CONST_ALARM_CONTROL_PANEL_NAME}" self._attr_unique_id = f"{client.unique}_CP" self._attr_device_info = DeviceInfo( identifiers={(AGENT_DOMAIN, client.unique)}, + name=f"{client.name} {CONST_ALARM_CONTROL_PANEL_NAME}", manufacturer="Agent", model=CONST_ALARM_CONTROL_PANEL_NAME, sw_version=client.version, diff --git a/homeassistant/components/agent_dvr/camera.py b/homeassistant/components/agent_dvr/camera.py index e485940034f..d49a1ac387e 100644 --- a/homeassistant/components/agent_dvr/camera.py +++ b/homeassistant/components/agent_dvr/camera.py @@ -72,12 +72,13 @@ class AgentCamera(MjpegCamera): _attr_attribution = ATTRIBUTION _attr_should_poll = True # Cameras default to False _attr_supported_features = CameraEntityFeature.ON_OFF + _attr_has_entity_name = True + _attr_name = None def __init__(self, device): """Initialize as a subclass of MjpegCamera.""" self.device = device self._removed = False - self._attr_name = f"{device.client.name} {device.name}" self._attr_unique_id = f"{device._client.unique}_{device.typeID}_{device.id}" super().__init__( name=device.name, @@ -88,7 +89,7 @@ class AgentCamera(MjpegCamera): identifiers={(AGENT_DOMAIN, self.unique_id)}, manufacturer="Agent", model="Camera", - name=self.name, + name=f"{device.client.name} {device.name}", sw_version=device.client.version, )