mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Add limitlessled night effect (#12567)
This commit is contained in:
parent
49d410546a
commit
5ad0baf128
@ -37,6 +37,8 @@ DEFAULT_FADE = False
|
|||||||
|
|
||||||
LED_TYPE = ['rgbw', 'rgbww', 'white', 'bridge-led', 'dimmer']
|
LED_TYPE = ['rgbw', 'rgbww', 'white', 'bridge-led', 'dimmer']
|
||||||
|
|
||||||
|
EFFECT_NIGHT = 'night'
|
||||||
|
|
||||||
RGB_BOUNDARY = 40
|
RGB_BOUNDARY = 40
|
||||||
|
|
||||||
WHITE = [255, 255, 255]
|
WHITE = [255, 255, 255]
|
||||||
@ -166,12 +168,16 @@ class LimitlessLEDGroup(Light):
|
|||||||
from limitlessled.group.rgbww import RgbwwGroup
|
from limitlessled.group.rgbww import RgbwwGroup
|
||||||
if isinstance(group, WhiteGroup):
|
if isinstance(group, WhiteGroup):
|
||||||
self._supported = SUPPORT_LIMITLESSLED_WHITE
|
self._supported = SUPPORT_LIMITLESSLED_WHITE
|
||||||
|
self._effect_list = [EFFECT_NIGHT]
|
||||||
elif isinstance(group, DimmerGroup):
|
elif isinstance(group, DimmerGroup):
|
||||||
self._supported = SUPPORT_LIMITLESSLED_DIMMER
|
self._supported = SUPPORT_LIMITLESSLED_DIMMER
|
||||||
|
self._effect_list = []
|
||||||
elif isinstance(group, RgbwGroup):
|
elif isinstance(group, RgbwGroup):
|
||||||
self._supported = SUPPORT_LIMITLESSLED_RGB
|
self._supported = SUPPORT_LIMITLESSLED_RGB
|
||||||
|
self._effect_list = [EFFECT_COLORLOOP, EFFECT_NIGHT, EFFECT_WHITE]
|
||||||
elif isinstance(group, RgbwwGroup):
|
elif isinstance(group, RgbwwGroup):
|
||||||
self._supported = SUPPORT_LIMITLESSLED_RGBWW
|
self._supported = SUPPORT_LIMITLESSLED_RGBWW
|
||||||
|
self._effect_list = [EFFECT_COLORLOOP, EFFECT_NIGHT, EFFECT_WHITE]
|
||||||
|
|
||||||
self.group = group
|
self.group = group
|
||||||
self.config = config
|
self.config = config
|
||||||
@ -231,6 +237,11 @@ class LimitlessLEDGroup(Light):
|
|||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
return self._supported
|
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
|
# pylint: disable=arguments-differ
|
||||||
@state(False)
|
@state(False)
|
||||||
def turn_off(self, transition_time, pipeline, **kwargs):
|
def turn_off(self, transition_time, pipeline, **kwargs):
|
||||||
@ -243,6 +254,12 @@ class LimitlessLEDGroup(Light):
|
|||||||
@state(True)
|
@state(True)
|
||||||
def turn_on(self, transition_time, pipeline, **kwargs):
|
def turn_on(self, transition_time, pipeline, **kwargs):
|
||||||
"""Turn on (or adjust property of) a group."""
|
"""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()
|
pipeline.on()
|
||||||
|
|
||||||
# Set up transition.
|
# Set up transition.
|
||||||
@ -282,7 +299,7 @@ class LimitlessLEDGroup(Light):
|
|||||||
pipeline.flash(duration=duration)
|
pipeline.flash(duration=duration)
|
||||||
|
|
||||||
# Add effects.
|
# 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:
|
if kwargs[ATTR_EFFECT] == EFFECT_COLORLOOP:
|
||||||
from limitlessled.presets import COLORLOOP
|
from limitlessled.presets import COLORLOOP
|
||||||
self.repeating = True
|
self.repeating = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user