mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Add LED brightness for Xiaomi Miio ZA5 fan (#60134)
This commit is contained in:
parent
615198a58f
commit
4649bc3c11
@ -33,6 +33,7 @@ from .const import (
|
||||
FEATURE_SET_FAN_LEVEL,
|
||||
FEATURE_SET_FAVORITE_LEVEL,
|
||||
FEATURE_SET_FAVORITE_RPM,
|
||||
FEATURE_SET_LED_BRIGHTNESS,
|
||||
FEATURE_SET_LED_BRIGHTNESS_LEVEL,
|
||||
FEATURE_SET_MOTOR_SPEED,
|
||||
FEATURE_SET_OSCILLATION_ANGLE,
|
||||
@ -70,6 +71,7 @@ ATTR_DELAY_OFF_COUNTDOWN = "delay_off_countdown"
|
||||
ATTR_FAN_LEVEL = "fan_level"
|
||||
ATTR_FAVORITE_LEVEL = "favorite_level"
|
||||
ATTR_FAVORITE_RPM = "favorite_rpm"
|
||||
ATTR_LED_BRIGHTNESS = "led_brightness"
|
||||
ATTR_LED_BRIGHTNESS_LEVEL = "led_brightness_level"
|
||||
ATTR_MOTOR_SPEED = "motor_speed"
|
||||
ATTR_OSCILLATION_ANGLE = "angle"
|
||||
@ -161,6 +163,16 @@ NUMBER_TYPES = {
|
||||
method="async_set_delay_off_countdown",
|
||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
||||
),
|
||||
FEATURE_SET_LED_BRIGHTNESS: XiaomiMiioNumberDescription(
|
||||
key=ATTR_LED_BRIGHTNESS,
|
||||
name="Led Brightness",
|
||||
icon="mdi:brightness-6",
|
||||
min_value=0,
|
||||
max_value=100,
|
||||
step=1,
|
||||
method="async_set_led_brightness",
|
||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
||||
),
|
||||
FEATURE_SET_LED_BRIGHTNESS_LEVEL: XiaomiMiioNumberDescription(
|
||||
key=ATTR_LED_BRIGHTNESS_LEVEL,
|
||||
name="Led Brightness",
|
||||
@ -244,6 +256,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
description.max_value = OSCILLATION_ANGLE_VALUES[model].max_value
|
||||
description.min_value = OSCILLATION_ANGLE_VALUES[model].min_value
|
||||
description.step = OSCILLATION_ANGLE_VALUES[model].step
|
||||
|
||||
entities.append(
|
||||
XiaomiNumberEntity(
|
||||
f"{config_entry.title} {description.name}",
|
||||
@ -354,6 +367,14 @@ class XiaomiNumberEntity(XiaomiCoordinatedMiioEntity, NumberEntity):
|
||||
level,
|
||||
)
|
||||
|
||||
async def async_set_led_brightness(self, level: int):
|
||||
"""Set the led brightness level."""
|
||||
return await self._try_command(
|
||||
"Setting the led brightness level of the miio device failed.",
|
||||
self._device.set_led_brightness,
|
||||
level,
|
||||
)
|
||||
|
||||
async def async_set_favorite_rpm(self, rpm: int):
|
||||
"""Set the target motor speed."""
|
||||
return await self._try_command(
|
||||
|
Loading…
x
Reference in New Issue
Block a user