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:
parent
8a83e810b8
commit
6393171fa4
16 changed files with 266 additions and 209 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue