mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Migrate xiaomi_aqara light to ColorMode (#70879)
This commit is contained in:
parent
613d49fa19
commit
d362e5b6b7
@ -6,8 +6,7 @@ import struct
|
|||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
SUPPORT_BRIGHTNESS,
|
ColorMode,
|
||||||
SUPPORT_COLOR,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -41,6 +40,9 @@ async def async_setup_entry(
|
|||||||
class XiaomiGatewayLight(XiaomiDevice, LightEntity):
|
class XiaomiGatewayLight(XiaomiDevice, LightEntity):
|
||||||
"""Representation of a XiaomiGatewayLight."""
|
"""Representation of a XiaomiGatewayLight."""
|
||||||
|
|
||||||
|
_attr_color_mode = ColorMode.HS
|
||||||
|
_attr_supported_color_modes = {ColorMode.HS}
|
||||||
|
|
||||||
def __init__(self, device, name, xiaomi_hub, config_entry):
|
def __init__(self, device, name, xiaomi_hub, config_entry):
|
||||||
"""Initialize the XiaomiGatewayLight."""
|
"""Initialize the XiaomiGatewayLight."""
|
||||||
self._data_key = "rgb"
|
self._data_key = "rgb"
|
||||||
@ -94,11 +96,6 @@ class XiaomiGatewayLight(XiaomiDevice, LightEntity):
|
|||||||
"""Return the hs color value."""
|
"""Return the hs color value."""
|
||||||
return self._hs
|
return self._hs
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return the supported features."""
|
|
||||||
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn the light on."""
|
"""Turn the light on."""
|
||||||
if ATTR_HS_COLOR in kwargs:
|
if ATTR_HS_COLOR in kwargs:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user