mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Migrate homeworks light to color_mode (#69271)
This commit is contained in:
parent
3416e9b621
commit
1c1b792fb7
@ -7,7 +7,7 @@ from pyhomeworks.pyhomeworks import HW_LIGHT_CHANGED
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
SUPPORT_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
@ -44,6 +44,9 @@ def setup_platform(
|
|||||||
class HomeworksLight(HomeworksDevice, LightEntity):
|
class HomeworksLight(HomeworksDevice, LightEntity):
|
||||||
"""Homeworks Light."""
|
"""Homeworks Light."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
|
||||||
def __init__(self, controller, addr, name, rate):
|
def __init__(self, controller, addr, name, rate):
|
||||||
"""Create device with Addr, name, and rate."""
|
"""Create device with Addr, name, and rate."""
|
||||||
super().__init__(controller, addr, name)
|
super().__init__(controller, addr, name)
|
||||||
@ -60,11 +63,6 @@ class HomeworksLight(HomeworksDevice, LightEntity):
|
|||||||
)
|
)
|
||||||
self._controller.request_dimmer_level(self._addr)
|
self._controller.request_dimmer_level(self._addr)
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Supported features."""
|
|
||||||
return SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn on the light."""
|
"""Turn on the light."""
|
||||||
if ATTR_BRIGHTNESS in kwargs:
|
if ATTR_BRIGHTNESS in kwargs:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user