Migrate unifiprotect to use has_entity_name (#119759)
This commit is contained in:
parent
b20160a465
commit
59ca5b04fa
12 changed files with 198 additions and 270 deletions
|
@ -188,7 +188,7 @@ async def _set_liveview(obj: Viewer, liveview_id: str) -> None:
|
|||
CAMERA_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
||||
ProtectSelectEntityDescription(
|
||||
key="recording_mode",
|
||||
name="Recording Mode",
|
||||
name="Recording mode",
|
||||
icon="mdi:video-outline",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_options=DEVICE_RECORDING_MODES,
|
||||
|
@ -199,7 +199,7 @@ CAMERA_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
),
|
||||
ProtectSelectEntityDescription(
|
||||
key="infrared",
|
||||
name="Infrared Mode",
|
||||
name="Infrared mode",
|
||||
icon="mdi:circle-opacity",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_required_field="feature_flags.has_led_ir",
|
||||
|
@ -211,7 +211,7 @@ CAMERA_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
),
|
||||
ProtectSelectEntityDescription[Camera](
|
||||
key="doorbell_text",
|
||||
name="Doorbell Text",
|
||||
name="Doorbell text",
|
||||
icon="mdi:card-text",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
device_class=DEVICE_CLASS_LCD_MESSAGE,
|
||||
|
@ -223,7 +223,7 @@ CAMERA_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
),
|
||||
ProtectSelectEntityDescription(
|
||||
key="chime_type",
|
||||
name="Chime Type",
|
||||
name="Chime type",
|
||||
icon="mdi:bell",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_required_field="feature_flags.has_chime",
|
||||
|
@ -235,7 +235,7 @@ CAMERA_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
),
|
||||
ProtectSelectEntityDescription(
|
||||
key="hdr_mode",
|
||||
name="HDR Mode",
|
||||
name="HDR mode",
|
||||
icon="mdi:brightness-7",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_required_field="feature_flags.has_hdr",
|
||||
|
@ -249,7 +249,7 @@ CAMERA_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
LIGHT_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
||||
ProtectSelectEntityDescription[Light](
|
||||
key=_KEY_LIGHT_MOTION,
|
||||
name="Light Mode",
|
||||
name="Light mode",
|
||||
icon="mdi:spotlight",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_options=MOTION_MODE_TO_LIGHT_MODE,
|
||||
|
@ -259,7 +259,7 @@ LIGHT_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
),
|
||||
ProtectSelectEntityDescription[Light](
|
||||
key="paired_camera",
|
||||
name="Paired Camera",
|
||||
name="Paired camera",
|
||||
icon="mdi:cctv",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_value="camera_id",
|
||||
|
@ -272,7 +272,7 @@ LIGHT_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
SENSE_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
||||
ProtectSelectEntityDescription(
|
||||
key="mount_type",
|
||||
name="Mount Type",
|
||||
name="Mount type",
|
||||
icon="mdi:screwdriver",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_options=MOUNT_TYPES,
|
||||
|
@ -283,7 +283,7 @@ SENSE_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
),
|
||||
ProtectSelectEntityDescription[Sensor](
|
||||
key="paired_camera",
|
||||
name="Paired Camera",
|
||||
name="Paired camera",
|
||||
icon="mdi:cctv",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_value="camera_id",
|
||||
|
@ -296,7 +296,7 @@ SENSE_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
|||
DOORLOCK_SELECTS: tuple[ProtectSelectEntityDescription, ...] = (
|
||||
ProtectSelectEntityDescription[Doorlock](
|
||||
key="paired_camera",
|
||||
name="Paired Camera",
|
||||
name="Paired camera",
|
||||
icon="mdi:cctv",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_value="camera_id",
|
||||
|
@ -369,7 +369,6 @@ class ProtectSelects(ProtectDeviceEntity, SelectEntity):
|
|||
"""Initialize the unifi protect select entity."""
|
||||
self._async_set_options(data, description)
|
||||
super().__init__(data, device, description)
|
||||
self._attr_name = f"{self.device.display_name} {self.entity_description.name}"
|
||||
|
||||
@callback
|
||||
def _async_update_device_from_protect(self, device: ProtectModelWithId) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue