mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Migrate opple light to ColorMode (#70875)
This commit is contained in:
parent
13cc7583ed
commit
f77bcd252e
@ -10,8 +10,7 @@ from homeassistant.components.light import (
|
|||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_COLOR_TEMP,
|
ATTR_COLOR_TEMP,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_BRIGHTNESS,
|
ColorMode,
|
||||||
SUPPORT_COLOR_TEMP,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||||
@ -55,6 +54,9 @@ def setup_platform(
|
|||||||
class OppleLight(LightEntity):
|
class OppleLight(LightEntity):
|
||||||
"""Opple light device."""
|
"""Opple light device."""
|
||||||
|
|
||||||
|
_attr_color_mode = ColorMode.COLOR_TEMP
|
||||||
|
_attr_supported_color_modes = {ColorMode.COLOR_TEMP}
|
||||||
|
|
||||||
def __init__(self, name, host):
|
def __init__(self, name, host):
|
||||||
"""Initialize an Opple light."""
|
"""Initialize an Opple light."""
|
||||||
|
|
||||||
@ -105,11 +107,6 @@ class OppleLight(LightEntity):
|
|||||||
"""Return maximum supported color temperature."""
|
"""Return maximum supported color temperature."""
|
||||||
return 333
|
return 333
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP
|
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Instruct the light to turn on."""
|
"""Instruct the light to turn on."""
|
||||||
_LOGGER.debug("Turn on light %s %s", self._device.ip, kwargs)
|
_LOGGER.debug("Turn on light %s %s", self._device.ip, kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user