Add entity translations to EZVIZ (#98123)
This commit is contained in:
parent
aacb8aecfc
commit
86f94662eb
12 changed files with 22 additions and 17 deletions
|
@ -54,8 +54,6 @@ async def async_setup_entry(
|
|||
class EzvizBinarySensor(EzvizEntity, BinarySensorEntity):
|
||||
"""Representation of a EZVIZ sensor."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: EzvizDataUpdateCoordinator,
|
||||
|
|
|
@ -103,7 +103,6 @@ class EzvizButtonEntity(EzvizEntity, ButtonEntity):
|
|||
"""Representation of a EZVIZ button entity."""
|
||||
|
||||
entity_description: EzvizButtonEntityDescription
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
@ -170,6 +170,8 @@ async def async_setup_entry(
|
|||
class EzvizCamera(EzvizEntity, Camera):
|
||||
"""An implementation of a EZVIZ security camera."""
|
||||
|
||||
_attr_name = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
|
@ -192,7 +194,6 @@ class EzvizCamera(EzvizEntity, Camera):
|
|||
self._ffmpeg_arguments = ffmpeg_arguments
|
||||
self._ffmpeg = get_ffmpeg_manager(hass)
|
||||
self._attr_unique_id = serial
|
||||
self._attr_name = self.data["name"]
|
||||
if camera_password:
|
||||
self._attr_supported_features = CameraEntityFeature.STREAM
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ from .coordinator import EzvizDataUpdateCoordinator
|
|||
class EzvizEntity(CoordinatorEntity[EzvizDataUpdateCoordinator], Entity):
|
||||
"""Generic entity encapsulating common features of EZVIZ device."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: EzvizDataUpdateCoordinator,
|
||||
|
|
|
@ -38,8 +38,6 @@ async def async_setup_entry(
|
|||
class EzvizLastMotion(EzvizEntity, ImageEntity):
|
||||
"""Return Last Motion Image from Ezviz Camera."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, coordinator: EzvizDataUpdateCoordinator, serial: str
|
||||
) -> None:
|
||||
|
|
|
@ -44,7 +44,7 @@ async def async_setup_entry(
|
|||
class EzvizLight(EzvizEntity, LightEntity):
|
||||
"""Representation of a EZVIZ light."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_translation_key = "light"
|
||||
_attr_color_mode = ColorMode.BRIGHTNESS
|
||||
_attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||
|
||||
|
@ -60,7 +60,6 @@ class EzvizLight(EzvizEntity, LightEntity):
|
|||
== DeviceCatagories.BATTERY_CAMERA_DEVICE_CATEGORY.value
|
||||
)
|
||||
self._attr_unique_id = f"{serial}_Light"
|
||||
self._attr_name = "Light"
|
||||
self._attr_is_on = self.data["switches"][DeviceSwitchType.ALARM_LIGHT.value]
|
||||
self._attr_brightness = round(
|
||||
percentage_to_ranged_value(
|
||||
|
|
|
@ -47,7 +47,7 @@ class EzvizNumberEntityDescription(
|
|||
|
||||
NUMBER_TYPE = EzvizNumberEntityDescription(
|
||||
key="detection_sensibility",
|
||||
name="Detection sensitivity",
|
||||
translation_key="detection_sensibility",
|
||||
icon="mdi:eye",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
native_min_value=0,
|
||||
|
|
|
@ -63,8 +63,6 @@ async def async_setup_entry(
|
|||
class EzvizSelect(EzvizEntity, SelectEntity):
|
||||
"""Representation of a EZVIZ select entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: EzvizDataUpdateCoordinator,
|
||||
|
|
|
@ -92,8 +92,6 @@ async def async_setup_entry(
|
|||
class EzvizSensor(EzvizEntity, SensorEntity):
|
||||
"""Representation of a EZVIZ sensor."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, coordinator: EzvizDataUpdateCoordinator, serial: str, sensor: str
|
||||
) -> None:
|
||||
|
|
|
@ -132,6 +132,16 @@
|
|||
"name": "Encryption"
|
||||
}
|
||||
},
|
||||
"light": {
|
||||
"light": {
|
||||
"name": "[%key:component::light::title%]"
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"detection_sensibility": {
|
||||
"name": "Detection sensitivity"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"alarm_sound_mod": {
|
||||
"name": "Alarm sound level"
|
||||
|
@ -201,6 +211,11 @@
|
|||
"follow_movement": {
|
||||
"name": "Follow movement"
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"firmware": {
|
||||
"name": "[%key:component::update::entity_component::firmware::name%]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
|
|
|
@ -134,8 +134,6 @@ async def async_setup_entry(
|
|||
class EzvizSwitch(EzvizEntity, SwitchEntity):
|
||||
"""Representation of a EZVIZ sensor."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, coordinator: EzvizDataUpdateCoordinator, serial: str, switch_number: int
|
||||
) -> None:
|
||||
|
|
|
@ -24,7 +24,7 @@ PARALLEL_UPDATES = 1
|
|||
|
||||
UPDATE_ENTITY_TYPES = UpdateEntityDescription(
|
||||
key="version",
|
||||
name="Firmware update",
|
||||
translation_key="firmware",
|
||||
device_class=UpdateDeviceClass.FIRMWARE,
|
||||
)
|
||||
|
||||
|
@ -49,7 +49,6 @@ async def async_setup_entry(
|
|||
class EzvizUpdateEntity(EzvizEntity, UpdateEntity):
|
||||
"""Representation of a EZVIZ Update entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_supported_features = (
|
||||
UpdateEntityFeature.INSTALL
|
||||
| UpdateEntityFeature.PROGRESS
|
||||
|
|
Loading…
Add table
Reference in a new issue