mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Add EZVIZ BinarySensorEntity proper names and translation key (#95698)
* Update binary_sensor.py * Add proper naming and translation keys * Apply suggestions from code review Co-authored-by: G Johansson <goran.johansson@shiftit.se> * Fix strings after merge. --------- Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
parent
ce0027a84e
commit
4e460f71f8
@ -22,9 +22,13 @@ BINARY_SENSOR_TYPES: dict[str, BinarySensorEntityDescription] = {
|
|||||||
device_class=BinarySensorDeviceClass.MOTION,
|
device_class=BinarySensorDeviceClass.MOTION,
|
||||||
),
|
),
|
||||||
"alarm_schedules_enabled": BinarySensorEntityDescription(
|
"alarm_schedules_enabled": BinarySensorEntityDescription(
|
||||||
key="alarm_schedules_enabled"
|
key="alarm_schedules_enabled",
|
||||||
|
translation_key="alarm_schedules_enabled",
|
||||||
|
),
|
||||||
|
"encrypted": BinarySensorEntityDescription(
|
||||||
|
key="encrypted",
|
||||||
|
translation_key="encrypted",
|
||||||
),
|
),
|
||||||
"encrypted": BinarySensorEntityDescription(key="encrypted"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +54,8 @@ 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,
|
||||||
@ -59,7 +65,6 @@ class EzvizBinarySensor(EzvizEntity, BinarySensorEntity):
|
|||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
super().__init__(coordinator, serial)
|
super().__init__(coordinator, serial)
|
||||||
self._sensor_name = binary_sensor
|
self._sensor_name = binary_sensor
|
||||||
self._attr_name = f"{self._camera_name} {binary_sensor.title()}"
|
|
||||||
self._attr_unique_id = f"{serial}_{self._camera_name}.{binary_sensor}"
|
self._attr_unique_id = f"{serial}_{self._camera_name}.{binary_sensor}"
|
||||||
self.entity_description = BINARY_SENSOR_TYPES[binary_sensor]
|
self.entity_description = BINARY_SENSOR_TYPES[binary_sensor]
|
||||||
|
|
||||||
|
@ -99,6 +99,14 @@
|
|||||||
"name": "Last motion image"
|
"name": "Last motion image"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"binary_sensor": {
|
||||||
|
"alarm_schedules_enabled": {
|
||||||
|
"name": "Alarm schedules enabled"
|
||||||
|
},
|
||||||
|
"encrypted": {
|
||||||
|
"name": "Encryption"
|
||||||
|
}
|
||||||
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"alarm_sound_mod": {
|
"alarm_sound_mod": {
|
||||||
"name": "Alarm sound level"
|
"name": "Alarm sound level"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user