diff --git a/homeassistant/components/light/yeelight.py b/homeassistant/components/light/yeelight.py index 7e0bd0e253e..65b32786ce7 100644 --- a/homeassistant/components/light/yeelight.py +++ b/homeassistant/components/light/yeelight.py @@ -44,13 +44,14 @@ DEVICE_SCHEMA = vol.Schema({ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( {vol.Optional(CONF_DEVICES, default={}): {cv.string: DEVICE_SCHEMA}, }) -SUPPORT_YEELIGHT_RGB = (SUPPORT_RGB_COLOR | - SUPPORT_COLOR_TEMP) - SUPPORT_YEELIGHT = (SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION | SUPPORT_FLASH) +SUPPORT_YEELIGHT_RGB = (SUPPORT_YEELIGHT | + SUPPORT_RGB_COLOR | + SUPPORT_COLOR_TEMP) + def _cmd(func): """A wrapper to catch exceptions from the bulb.""" @@ -179,9 +180,6 @@ class YeelightLight(Light): self._bulb_device = yeelight.Bulb(self._ipaddr) self._bulb_device.get_properties() # force init for type - btype = self._bulb_device.bulb_type - if btype == yeelight.BulbType.Color: - self._supported_features |= SUPPORT_YEELIGHT_RGB self._available = True except yeelight.BulbException as ex: self._available = False @@ -203,6 +201,9 @@ class YeelightLight(Light): try: self._bulb.get_properties() + if self._bulb_device.bulb_type == yeelight.BulbType.Color: + self._supported_features = SUPPORT_YEELIGHT_RGB + self._is_on = self._properties.get("power") == "on" bright = self._properties.get("bright", None)