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
2 changed files with 16 additions and 3 deletions
|
@ -22,9 +22,13 @@ BINARY_SENSOR_TYPES: dict[str, BinarySensorEntityDescription] = {
|
|||
device_class=BinarySensorDeviceClass.MOTION,
|
||||
),
|
||||
"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):
|
||||
"""Representation of a EZVIZ sensor."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: EzvizDataUpdateCoordinator,
|
||||
|
@ -59,7 +65,6 @@ class EzvizBinarySensor(EzvizEntity, BinarySensorEntity):
|
|||
"""Initialize the sensor."""
|
||||
super().__init__(coordinator, serial)
|
||||
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.entity_description = BINARY_SENSOR_TYPES[binary_sensor]
|
||||
|
||||
|
|
|
@ -99,6 +99,14 @@
|
|||
"name": "Last motion image"
|
||||
}
|
||||
},
|
||||
"binary_sensor": {
|
||||
"alarm_schedules_enabled": {
|
||||
"name": "Alarm schedules enabled"
|
||||
},
|
||||
"encrypted": {
|
||||
"name": "Encryption"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"alarm_sound_mod": {
|
||||
"name": "Alarm sound level"
|
||||
|
|
Loading…
Add table
Reference in a new issue