Add translations for Nuki entity name and battery critical state attribute (#90772)

* Add translations for Nuki entity name and battery critical state attribute

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Remove door sensor name

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

---------

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>
pull/90855/head
Patrick ZAJDA 2023-04-04 13:43:51 +02:00 committed by Paulus Schoutsen
parent c43dc37713
commit af34e25c89
4 changed files with 21 additions and 2 deletions

View File

@ -36,7 +36,6 @@ class NukiDoorsensorEntity(NukiEntity[NukiDevice], BinarySensorEntity):
"""Representation of a Nuki Lock Doorsensor."""
_attr_has_entity_name = True
_attr_name = "Door sensor"
_attr_device_class = BinarySensorDeviceClass.DOOR
@property

View File

@ -71,6 +71,7 @@ class NukiDeviceEntity(NukiEntity[_NukiDeviceT], LockEntity):
_attr_has_entity_name = True
_attr_supported_features = LockEntityFeature.OPEN
_attr_translation_key = "nuki_lock"
@property
def unique_id(self) -> str | None:

View File

@ -29,7 +29,7 @@ class NukiBatterySensor(NukiEntity[NukiDevice], SensorEntity):
"""Representation of a Nuki Lock Battery sensor."""
_attr_has_entity_name = True
_attr_name = "Battery"
_attr_translation_key = "battery"
_attr_native_unit_of_measurement = PERCENTAGE
_attr_device_class = SensorDeviceClass.BATTERY
_attr_entity_category = EntityCategory.DIAGNOSTIC

View File

@ -31,5 +31,24 @@
"title": "Nuki webhook URL uses HTTPS (SSL)",
"description": "The Nuki bridge can not push events to an HTTPS address (SSL), please configure a (local) HTTP address under \"Home Assistant URL\" in the [network settings]({network_link}). The current (local) address is: `{base_url}`, a valid address could, for example, be `http://192.168.1.10:8123` where `192.168.1.10` is the IP of the Home Assistant device"
}
},
"entity": {
"lock": {
"nuki_lock": {
"state_attributes": {
"battery_critical": {
"state": {
"on": "[%key:component::binary_sensor::entity_component::battery::state::on%]",
"off": "[%key:component::binary_sensor::entity_component::battery::state::off%]"
}
}
}
}
},
"sensor": {
"battery": {
"name": "[%key:component::sensor::entity_component::battery::name%]"
}
}
}
}