Add translation entiry support (zha) (#101909)

* zha: Add translation to binary sensors

* Add some small test for name

* Add translations for sensors

* Correct some tests

* Adjust summation key

* Add translation keys for button

* Add translation keys to climate

* Add translation keys for cover

* Add translation keys to fan

* Add translations to light

* Add translations for lock

* Add translation keys to number

* Add translationk keys to select

* Add translations for switch entities

* Add translation to alarm control panel

* Map to some more standard device classes

* Use shorter references

* Remove explicit name from identify button

* Correct tests

* Correction after rebase
This commit is contained in:
Joakim Plate 2023-10-17 21:59:49 +02:00 committed by GitHub
parent 4ae5757bc1
commit 29e8814d1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 633 additions and 247 deletions

View file

@ -73,7 +73,7 @@ async def async_setup_entry(
class ZhaCover(ZhaEntity, CoverEntity):
"""Representation of a ZHA cover."""
_attr_name: str = "Cover"
_attr_translation_key: str = "cover"
def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs):
"""Init this sensor."""
@ -205,7 +205,7 @@ class Shade(ZhaEntity, CoverEntity):
"""ZHA Shade."""
_attr_device_class = CoverDeviceClass.SHADE
_attr_name: str = "Shade"
_attr_translation_key: str = "shade"
def __init__(
self,
@ -313,9 +313,8 @@ class Shade(ZhaEntity, CoverEntity):
class KeenVent(Shade):
"""Keen vent cover."""
_attr_name: str = "Keen vent"
_attr_device_class = CoverDeviceClass.DAMPER
_attr_translation_key: str = "keen_vent"
async def async_open_cover(self, **kwargs: Any) -> None:
"""Open the cover."""