Migrate futurenow light to color_mode (#69257)

pull/69253/head
Erik Montnemery 2022-04-04 18:18:50 +02:00 committed by GitHub
parent 5d56f94786
commit dffb3cc196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -6,8 +6,9 @@ import voluptuous as vol
from homeassistant.components.light import ( from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_ONOFF,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
LightEntity, LightEntity,
) )
from homeassistant.const import CONF_DEVICES, CONF_HOST, CONF_NAME, CONF_PORT from homeassistant.const import CONF_DEVICES, CONF_HOST, CONF_NAME, CONF_PORT
@ -106,11 +107,16 @@ class FutureNowLight(LightEntity):
return self._brightness return self._brightness
@property @property
def supported_features(self): def color_mode(self) -> str:
"""Flag supported features.""" """Return the color mode of the light."""
if self._dimmable: if self._dimmable:
return SUPPORT_BRIGHTNESS return COLOR_MODE_BRIGHTNESS
return 0 return COLOR_MODE_ONOFF
@property
def supported_color_modes(self) -> set[str] | None:
"""Flag supported color modes."""
return {self.color_mode}
def turn_on(self, **kwargs): def turn_on(self, **kwargs):
"""Turn the light on.""" """Turn the light on."""