Migrate ads light to color_mode (#69071)

pull/69233/head^2
Erik Montnemery 2022-04-04 10:50:47 +02:00 committed by GitHub
parent c2c6d12d73
commit bfbe0d1d76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -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."""