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