From cb79126cd9a3994549cd112e57043811b42c01e7 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 4 Apr 2022 18:28:30 +0200 Subject: [PATCH] Migrate ihc light to color_mode (#69280) --- homeassistant/components/ihc/light.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/ihc/light.py b/homeassistant/components/ihc/light.py index b86f9fb3c8a..54075fdedac 100644 --- a/homeassistant/components/ihc/light.py +++ b/homeassistant/components/ihc/light.py @@ -5,7 +5,8 @@ from ihcsdk.ihccontroller import IHCController from homeassistant.components.light import ( ATTR_BRIGHTNESS, - SUPPORT_BRIGHTNESS, + COLOR_MODE_BRIGHTNESS, + COLOR_MODE_ONOFF, LightEntity, ) from homeassistant.core import HomeAssistant @@ -78,6 +79,12 @@ class IhcLight(IHCDevice, LightEntity): self._dimmable = dimmable self._state = False + if self._dimmable: + self._attr_color_mode = COLOR_MODE_BRIGHTNESS + else: + self._attr_color_mode = COLOR_MODE_ONOFF + self._attr_supported_color_modes = {self._attr_color_mode} + @property def brightness(self) -> int: """Return the brightness of this light between 0..255.""" @@ -88,13 +95,6 @@ class IhcLight(IHCDevice, LightEntity): """Return true if light is on.""" return self._state - @property - def supported_features(self): - """Flag supported features.""" - if self._dimmable: - return SUPPORT_BRIGHTNESS - return 0 - async def async_turn_on(self, **kwargs): """Turn the light on.""" if ATTR_BRIGHTNESS in kwargs: