Add entity translations to Big Ass Fans (#95136)

This commit is contained in:
Joost Lekkerkerker 2023-06-25 02:00:20 +02:00 committed by GitHub
parent c8430e4557
commit fa334cf2bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 111 additions and 36 deletions

View file

@ -37,7 +37,7 @@ class BAFNumberDescription(NumberEntityDescription, BAFNumberDescriptionMixin):
AUTO_COMFORT_NUMBER_DESCRIPTIONS = (
BAFNumberDescription(
key="comfort_min_speed",
name="Auto Comfort Minimum Speed",
translation_key="comfort_min_speed",
native_step=1,
native_min_value=0,
native_max_value=SPEED_RANGE[1] - 1,
@ -47,7 +47,7 @@ AUTO_COMFORT_NUMBER_DESCRIPTIONS = (
),
BAFNumberDescription(
key="comfort_max_speed",
name="Auto Comfort Maximum Speed",
translation_key="comfort_max_speed",
native_step=1,
native_min_value=1,
native_max_value=SPEED_RANGE[1],
@ -57,7 +57,7 @@ AUTO_COMFORT_NUMBER_DESCRIPTIONS = (
),
BAFNumberDescription(
key="comfort_heat_assist_speed",
name="Auto Comfort Heat Assist Speed",
translation_key="comfort_heat_assist_speed",
native_step=1,
native_min_value=SPEED_RANGE[0],
native_max_value=SPEED_RANGE[1],
@ -70,7 +70,7 @@ AUTO_COMFORT_NUMBER_DESCRIPTIONS = (
FAN_NUMBER_DESCRIPTIONS = (
BAFNumberDescription(
key="return_to_auto_timeout",
name="Return to Auto Timeout",
translation_key="return_to_auto_timeout",
native_step=1,
native_min_value=ONE_MIN_SECS,
native_max_value=HALF_DAY_SECS,
@ -81,7 +81,7 @@ FAN_NUMBER_DESCRIPTIONS = (
),
BAFNumberDescription(
key="motion_sense_timeout",
name="Motion Sense Timeout",
translation_key="motion_sense_timeout",
native_step=1,
native_min_value=ONE_MIN_SECS,
native_max_value=ONE_DAY_SECS,
@ -95,7 +95,7 @@ FAN_NUMBER_DESCRIPTIONS = (
LIGHT_NUMBER_DESCRIPTIONS = (
BAFNumberDescription(
key="light_return_to_auto_timeout",
name="Light Return to Auto Timeout",
translation_key="light_return_to_auto_timeout",
native_step=1,
native_min_value=ONE_MIN_SECS,
native_max_value=HALF_DAY_SECS,
@ -106,7 +106,7 @@ LIGHT_NUMBER_DESCRIPTIONS = (
),
BAFNumberDescription(
key="light_auto_motion_timeout",
name="Light Motion Sense Timeout",
translation_key="light_auto_motion_timeout",
native_step=1,
native_min_value=ONE_MIN_SECS,
native_max_value=ONE_DAY_SECS,
@ -144,7 +144,7 @@ class BAFNumber(BAFEntity, NumberEntity):
def __init__(self, device: Device, description: BAFNumberDescription) -> None:
"""Initialize the entity."""
self.entity_description = description
super().__init__(device, f"{device.name} {description.name}")
super().__init__(device)
self._attr_unique_id = f"{self._device.mac_address}-{description.key}"
@callback