Migrate mochad light to color_mode (#69425)
parent
c43bd047fd
commit
0c72a39e23
|
@ -9,8 +9,8 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
|
COLOR_MODE_BRIGHTNESS,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_BRIGHTNESS,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_ADDRESS, CONF_DEVICES, CONF_NAME, CONF_PLATFORM
|
from homeassistant.const import CONF_ADDRESS, CONF_DEVICES, CONF_NAME, CONF_PLATFORM
|
||||||
|
@ -56,6 +56,9 @@ def setup_platform(
|
||||||
class MochadLight(LightEntity):
|
class MochadLight(LightEntity):
|
||||||
"""Representation of a X10 dimmer over Mochad."""
|
"""Representation of a X10 dimmer over Mochad."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
|
||||||
def __init__(self, hass, ctrl, dev):
|
def __init__(self, hass, ctrl, dev):
|
||||||
"""Initialize a Mochad Light Device."""
|
"""Initialize a Mochad Light Device."""
|
||||||
|
|
||||||
|
@ -89,11 +92,6 @@ class MochadLight(LightEntity):
|
||||||
"""Return true if the light is on."""
|
"""Return true if the light is on."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return supported features."""
|
|
||||||
return SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def assumed_state(self):
|
def assumed_state(self):
|
||||||
"""X10 devices are normally 1-way so we have to assume the state."""
|
"""X10 devices are normally 1-way so we have to assume the state."""
|
||||||
|
|
Loading…
Reference in New Issue