mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Migrate Skybell to new entity naming style (#75341)
This commit is contained in:
parent
460f522d6d
commit
27e3ff9c69
@ -41,7 +41,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
CAMERA_TYPES: tuple[CameraEntityDescription, ...] = (
|
||||
CameraEntityDescription(key="activity", name="Last Activity"),
|
||||
CameraEntityDescription(key="activity", name="Last activity"),
|
||||
CameraEntityDescription(key="avatar", name="Camera"),
|
||||
)
|
||||
|
||||
|
@ -16,6 +16,7 @@ class SkybellEntity(CoordinatorEntity[SkybellDataUpdateCoordinator]):
|
||||
"""An HA implementation for Skybell entity."""
|
||||
|
||||
_attr_attribution = "Data provided by Skybell.com"
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, coordinator: SkybellDataUpdateCoordinator, description: EntityDescription
|
||||
@ -23,14 +24,12 @@ class SkybellEntity(CoordinatorEntity[SkybellDataUpdateCoordinator]):
|
||||
"""Initialize a SkyBell entity."""
|
||||
super().__init__(coordinator)
|
||||
self.entity_description = description
|
||||
if description.name != coordinator.device.name:
|
||||
self._attr_name = f"{self._device.name} {description.name}"
|
||||
self._attr_unique_id = f"{self._device.device_id}_{description.key}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, self._device.device_id)},
|
||||
manufacturer=DEFAULT_NAME,
|
||||
model=self._device.type,
|
||||
name=self._device.name,
|
||||
name=self._device.name.capitalize(),
|
||||
sw_version=self._device.firmware_ver,
|
||||
)
|
||||
if self._device.mac:
|
||||
|
@ -23,13 +23,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up Skybell switch."""
|
||||
async_add_entities(
|
||||
SkybellLight(
|
||||
coordinator,
|
||||
LightEntityDescription(
|
||||
key=coordinator.device.name,
|
||||
name=coordinator.device.name,
|
||||
),
|
||||
)
|
||||
SkybellLight(coordinator, LightEntityDescription(key="light"))
|
||||
for coordinator in hass.data[DOMAIN][entry.entry_id]
|
||||
)
|
||||
|
||||
|
@ -35,27 +35,27 @@ class SkybellSensorEntityDescription(SensorEntityDescription):
|
||||
SENSOR_TYPES: tuple[SkybellSensorEntityDescription, ...] = (
|
||||
SkybellSensorEntityDescription(
|
||||
key="chime_level",
|
||||
name="Chime Level",
|
||||
name="Chime level",
|
||||
icon="mdi:bell-ring",
|
||||
value_fn=lambda device: device.outdoor_chime_level,
|
||||
),
|
||||
SkybellSensorEntityDescription(
|
||||
key="last_button_event",
|
||||
name="Last Button Event",
|
||||
name="Last button event",
|
||||
icon="mdi:clock",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda device: device.latest("button").get(CONST.CREATED_AT),
|
||||
),
|
||||
SkybellSensorEntityDescription(
|
||||
key="last_motion_event",
|
||||
name="Last Motion Event",
|
||||
name="Last motion event",
|
||||
icon="mdi:clock",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda device: device.latest("motion").get(CONST.CREATED_AT),
|
||||
),
|
||||
SkybellSensorEntityDescription(
|
||||
key=CONST.ATTR_LAST_CHECK_IN,
|
||||
name="Last Check in",
|
||||
name="Last check in",
|
||||
icon="mdi:clock",
|
||||
entity_registry_enabled_default=False,
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
@ -64,7 +64,7 @@ SENSOR_TYPES: tuple[SkybellSensorEntityDescription, ...] = (
|
||||
),
|
||||
SkybellSensorEntityDescription(
|
||||
key="motion_threshold",
|
||||
name="Motion Threshold",
|
||||
name="Motion threshold",
|
||||
icon="mdi:walk",
|
||||
entity_registry_enabled_default=False,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
@ -72,7 +72,7 @@ SENSOR_TYPES: tuple[SkybellSensorEntityDescription, ...] = (
|
||||
),
|
||||
SkybellSensorEntityDescription(
|
||||
key="video_profile",
|
||||
name="Video Profile",
|
||||
name="Video profile",
|
||||
entity_registry_enabled_default=False,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda device: device.video_profile,
|
||||
@ -87,7 +87,7 @@ SENSOR_TYPES: tuple[SkybellSensorEntityDescription, ...] = (
|
||||
),
|
||||
SkybellSensorEntityDescription(
|
||||
key=CONST.ATTR_WIFI_STATUS,
|
||||
name="Wifi Status",
|
||||
name="Wifi status",
|
||||
icon="mdi:wifi-strength-3",
|
||||
entity_registry_enabled_default=False,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
|
@ -22,15 +22,15 @@ from .entity import SkybellEntity
|
||||
SWITCH_TYPES: tuple[SwitchEntityDescription, ...] = (
|
||||
SwitchEntityDescription(
|
||||
key="do_not_disturb",
|
||||
name="Do Not Disturb",
|
||||
name="Do not disturb",
|
||||
),
|
||||
SwitchEntityDescription(
|
||||
key="do_not_ring",
|
||||
name="Do Not Ring",
|
||||
name="Do not ring",
|
||||
),
|
||||
SwitchEntityDescription(
|
||||
key="motion_sensor",
|
||||
name="Motion Sensor",
|
||||
name="Motion sensor",
|
||||
),
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user