Adjust Hue integration to use Entity descriptions and translatable entity names (#101413)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
Marcel van der Veldt 2023-10-09 14:14:07 +02:00 committed by GitHub
parent 8a83e810b8
commit 6393171fa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 266 additions and 209 deletions

View file

@ -71,6 +71,7 @@ class HueButtonEventEntity(HueBaseEntity, EventEntity):
key="button",
device_class=EventDeviceClass.BUTTON,
translation_key="button",
has_entity_name=True,
)
def __init__(self, *args: Any, **kwargs: Any) -> None:
@ -89,7 +90,8 @@ class HueButtonEventEntity(HueBaseEntity, EventEntity):
@property
def name(self) -> str:
"""Return name for the entity."""
return f"{super().name} {self.resource.metadata.control_id}"
# this can be translated too as soon as we support arguments into translations ?
return f"Button {self.resource.metadata.control_id}"
@callback
def _handle_event(self, event_type: EventType, resource: Button) -> None:
@ -112,6 +114,7 @@ class HueRotaryEventEntity(HueBaseEntity, EventEntity):
RelativeRotaryDirection.CLOCK_WISE.value,
RelativeRotaryDirection.COUNTER_CLOCK_WISE.value,
],
has_entity_name=True,
)
@callback