Add entity translations to SkyBell (#96096)

* Add entity translations to SkyBell

* Add entity translations to SkyBell
This commit is contained in:
Joost Lekkerkerker 2023-07-08 19:55:10 +02:00 committed by GitHub
parent 88d9a29b55
commit 7f6309c5cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 15 deletions

View File

@ -19,12 +19,11 @@ from .entity import SkybellEntity
BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription(
key="button",
name="Button",
translation_key="button",
device_class=BinarySensorDeviceClass.OCCUPANCY,
),
BinarySensorEntityDescription(
key="motion",
name="Motion",
device_class=BinarySensorDeviceClass.MOTION,
),
)

View File

@ -17,8 +17,14 @@ from .coordinator import SkybellDataUpdateCoordinator
from .entity import SkybellEntity
CAMERA_TYPES: tuple[CameraEntityDescription, ...] = (
CameraEntityDescription(key="activity", name="Last activity"),
CameraEntityDescription(key="avatar", name="Camera"),
CameraEntityDescription(
key="activity",
translation_key="activity",
),
CameraEntityDescription(
key="avatar",
translation_key="camera",
),
)

View File

@ -35,6 +35,7 @@ class SkybellLight(SkybellEntity, LightEntity):
_attr_color_mode = ColorMode.RGB
_attr_supported_color_modes = {ColorMode.RGB}
_attr_name = None
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the light."""

View File

@ -39,27 +39,27 @@ class SkybellSensorEntityDescription(
SENSOR_TYPES: tuple[SkybellSensorEntityDescription, ...] = (
SkybellSensorEntityDescription(
key="chime_level",
name="Chime level",
translation_key="chime_level",
icon="mdi:bell-ring",
value_fn=lambda device: device.outdoor_chime_level,
),
SkybellSensorEntityDescription(
key="last_button_event",
name="Last button event",
translation_key="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",
translation_key="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",
translation_key="last_check_in",
icon="mdi:clock",
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.TIMESTAMP,
@ -68,7 +68,7 @@ SENSOR_TYPES: tuple[SkybellSensorEntityDescription, ...] = (
),
SkybellSensorEntityDescription(
key="motion_threshold",
name="Motion threshold",
translation_key="motion_threshold",
icon="mdi:walk",
entity_registry_enabled_default=False,
entity_category=EntityCategory.DIAGNOSTIC,
@ -76,14 +76,14 @@ SENSOR_TYPES: tuple[SkybellSensorEntityDescription, ...] = (
),
SkybellSensorEntityDescription(
key="video_profile",
name="Video profile",
translation_key="video_profile",
entity_registry_enabled_default=False,
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda device: device.video_profile,
),
SkybellSensorEntityDescription(
key=CONST.ATTR_WIFI_SSID,
name="Wifi SSID",
translation_key="wifi_ssid",
icon="mdi:wifi-settings",
entity_registry_enabled_default=False,
entity_category=EntityCategory.DIAGNOSTIC,
@ -91,7 +91,7 @@ SENSOR_TYPES: tuple[SkybellSensorEntityDescription, ...] = (
),
SkybellSensorEntityDescription(
key=CONST.ATTR_WIFI_STATUS,
name="Wifi status",
translation_key="wifi_status",
icon="mdi:wifi-strength-3",
entity_registry_enabled_default=False,
entity_category=EntityCategory.DIAGNOSTIC,

View File

@ -24,5 +24,57 @@
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
}
},
"entity": {
"binary_sensor": {
"button": {
"name": "Button"
}
},
"camera": {
"activity": {
"name": "Last activity"
},
"camera": {
"name": "[%key:component::camera::title%]"
}
},
"sensor": {
"chime_level": {
"name": "Chime level"
},
"last_button_event": {
"name": "Last button event"
},
"last_motion_event": {
"name": "Last motion event"
},
"last_check_in": {
"name": "Last check in"
},
"motion_threshold": {
"name": "Motion threshold"
},
"video_profile": {
"name": "Video profile"
},
"wifi_ssid": {
"name": "Wi-Fi SSID"
},
"wifi_status": {
"name": "Wi-Fi status"
}
},
"switch": {
"do_not_disturb": {
"name": "Do not disturb"
},
"do_not_ring": {
"name": "Do not ring"
},
"motion_sensor": {
"name": "Motion sensor"
}
}
}
}

View File

@ -14,15 +14,15 @@ from .entity import SkybellEntity
SWITCH_TYPES: tuple[SwitchEntityDescription, ...] = (
SwitchEntityDescription(
key="do_not_disturb",
name="Do not disturb",
translation_key="do_not_disturb",
),
SwitchEntityDescription(
key="do_not_ring",
name="Do not ring",
translation_key="do_not_ring",
),
SwitchEntityDescription(
key="motion_sensor",
name="Motion sensor",
translation_key="motion_sensor",
),
)