diff --git a/homeassistant/components/light/limitlessled.py b/homeassistant/components/light/limitlessled.py index 910e3aebcfb..0606d097d49 100644 --- a/homeassistant/components/light/limitlessled.py +++ b/homeassistant/components/light/limitlessled.py @@ -37,6 +37,8 @@ DEFAULT_FADE = False LED_TYPE = ['rgbw', 'rgbww', 'white', 'bridge-led', 'dimmer'] +EFFECT_NIGHT = 'night' + RGB_BOUNDARY = 40 WHITE = [255, 255, 255] @@ -166,12 +168,16 @@ class LimitlessLEDGroup(Light): from limitlessled.group.rgbww import RgbwwGroup if isinstance(group, WhiteGroup): self._supported = SUPPORT_LIMITLESSLED_WHITE + self._effect_list = [EFFECT_NIGHT] elif isinstance(group, DimmerGroup): self._supported = SUPPORT_LIMITLESSLED_DIMMER + self._effect_list = [] elif isinstance(group, RgbwGroup): self._supported = SUPPORT_LIMITLESSLED_RGB + self._effect_list = [EFFECT_COLORLOOP, EFFECT_NIGHT, EFFECT_WHITE] elif isinstance(group, RgbwwGroup): self._supported = SUPPORT_LIMITLESSLED_RGBWW + self._effect_list = [EFFECT_COLORLOOP, EFFECT_NIGHT, EFFECT_WHITE] self.group = group self.config = config @@ -231,6 +237,11 @@ class LimitlessLEDGroup(Light): """Flag supported features.""" return self._supported + @property + def effect_list(self): + """Return the list of supported effects for this light.""" + return self._effect_list + # pylint: disable=arguments-differ @state(False) def turn_off(self, transition_time, pipeline, **kwargs): @@ -243,6 +254,12 @@ class LimitlessLEDGroup(Light): @state(True) def turn_on(self, transition_time, pipeline, **kwargs): """Turn on (or adjust property of) a group.""" + # The night effect does not need a turned on light + if kwargs.get(ATTR_EFFECT) == EFFECT_NIGHT: + if EFFECT_NIGHT in self._effect_list: + pipeline.night_light() + return + pipeline.on() # Set up transition. @@ -282,7 +299,7 @@ class LimitlessLEDGroup(Light): pipeline.flash(duration=duration) # Add effects. - if ATTR_EFFECT in kwargs and self._supported & SUPPORT_EFFECT: + if ATTR_EFFECT in kwargs and self._effect_list: if kwargs[ATTR_EFFECT] == EFFECT_COLORLOOP: from limitlessled.presets import COLORLOOP self.repeating = True