From bfbe0d1d76a2c5d1d4cf99723133a0ff8564cadd Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 4 Apr 2022 10:50:47 +0200 Subject: [PATCH] Migrate ads light to color_mode (#69071) --- homeassistant/components/ads/light.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/ads/light.py b/homeassistant/components/ads/light.py index a6bccc68fe5..316243f9bae 100644 --- a/homeassistant/components/ads/light.py +++ b/homeassistant/components/ads/light.py @@ -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."""