Migrate ads light to color_mode (#69071)
parent
c2c6d12d73
commit
bfbe0d1d76
|
@ -6,8 +6,9 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
COLOR_MODE_BRIGHTNESS,
|
||||
COLOR_MODE_ONOFF,
|
||||
PLATFORM_SCHEMA,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
LightEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_NAME
|
||||
|
@ -60,7 +61,11 @@ class AdsLight(AdsEntity, LightEntity):
|
|||
self._state_dict[STATE_KEY_BRIGHTNESS] = None
|
||||
self._ads_var_brightness = ads_var_brightness
|
||||
if ads_var_brightness is not None:
|
||||
self._attr_supported_features = SUPPORT_BRIGHTNESS
|
||||
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||
self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||
else:
|
||||
self._attr_color_mode = COLOR_MODE_ONOFF
|
||||
self._attr_supported_color_modes = {COLOR_MODE_ONOFF}
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Register device notification."""
|
||||
|
|
Loading…
Reference in New Issue