Migrate sisyphus light to color_mode (#69521)
parent
ee71dcca6c
commit
2cc3bfa056
|
@ -5,7 +5,7 @@ import logging
|
|||
|
||||
import aiohttp
|
||||
|
||||
from homeassistant.components.light import SUPPORT_BRIGHTNESS, LightEntity
|
||||
from homeassistant.components.light import COLOR_MODE_BRIGHTNESS, LightEntity
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
|
@ -16,8 +16,6 @@ from . import DATA_SISYPHUS
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
SUPPORTED_FEATURES = SUPPORT_BRIGHTNESS
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
|
@ -41,6 +39,9 @@ async def async_setup_platform(
|
|||
class SisyphusLight(LightEntity):
|
||||
"""Representation of a Sisyphus table as a light."""
|
||||
|
||||
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||
|
||||
def __init__(self, name, table):
|
||||
"""Initialize the Sisyphus table."""
|
||||
self._name = name
|
||||
|
@ -79,11 +80,6 @@ class SisyphusLight(LightEntity):
|
|||
"""Return the current brightness of the table's ring light."""
|
||||
return self._table.brightness * 255
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Return the features supported by the table; i.e. brightness."""
|
||||
return SUPPORTED_FEATURES
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
"""Put the table to sleep."""
|
||||
await self._table.sleep()
|
||||
|
|
Loading…
Reference in New Issue