mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
add disco, white effects
This commit is contained in:
parent
c6b5a04312
commit
3cd89f8474
@ -96,6 +96,7 @@ FLASH_LONG = "long"
|
|||||||
# Apply an effect to the light, can be EFFECT_COLORLOOP
|
# Apply an effect to the light, can be EFFECT_COLORLOOP
|
||||||
ATTR_EFFECT = "effect"
|
ATTR_EFFECT = "effect"
|
||||||
EFFECT_COLORLOOP = "colorloop"
|
EFFECT_COLORLOOP = "colorloop"
|
||||||
|
EFFECT_WHITE = "white"
|
||||||
|
|
||||||
LIGHT_PROFILES_FILE = "light_profiles.csv"
|
LIGHT_PROFILES_FILE = "light_profiles.csv"
|
||||||
|
|
||||||
@ -282,6 +283,8 @@ def setup(hass, config):
|
|||||||
if ATTR_EFFECT in dat:
|
if ATTR_EFFECT in dat:
|
||||||
if dat[ATTR_EFFECT] == EFFECT_COLORLOOP:
|
if dat[ATTR_EFFECT] == EFFECT_COLORLOOP:
|
||||||
params[ATTR_EFFECT] = EFFECT_COLORLOOP
|
params[ATTR_EFFECT] = EFFECT_COLORLOOP
|
||||||
|
if dat[ATTR_EFFECT] == EFFECT_WHITE:
|
||||||
|
params[ATTR_EFFECT] = EFFECT_WHITE
|
||||||
|
|
||||||
for light in target_lights:
|
for light in target_lights:
|
||||||
light.turn_on(**params)
|
light.turn_on(**params)
|
||||||
|
@ -18,7 +18,8 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.const import DEVICE_DEFAULT_NAME
|
from homeassistant.const import DEVICE_DEFAULT_NAME
|
||||||
from homeassistant.components.light import (Light, ATTR_BRIGHTNESS,
|
from homeassistant.components.light import (Light, ATTR_BRIGHTNESS,
|
||||||
ATTR_XY_COLOR)
|
ATTR_XY_COLOR, ATTR_EFFECT,
|
||||||
|
EFFECT_COLORLOOP, EFFECT_WHITE)
|
||||||
from homeassistant.util.color import color_RGB_to_xy
|
from homeassistant.util.color import color_RGB_to_xy
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -159,10 +160,22 @@ class RGBWLimitlessLED(LimitlessLED):
|
|||||||
if ATTR_XY_COLOR in kwargs:
|
if ATTR_XY_COLOR in kwargs:
|
||||||
self._xy_color = kwargs[ATTR_XY_COLOR]
|
self._xy_color = kwargs[ATTR_XY_COLOR]
|
||||||
|
|
||||||
self.pool.execute(self.controller_id, "set_color",
|
effect = kwargs.get(ATTR_EFFECT)
|
||||||
self._xy_to_led_color(self._xy_color), self.group)
|
|
||||||
|
if effect:
|
||||||
|
if effect == EFFECT_COLORLOOP:
|
||||||
|
self.pool.execute(self.controller_id, "disco", self.group)
|
||||||
|
if effect == EFFECT_WHITE:
|
||||||
|
self.pool.execute(self.controller_id, "white", self.group)
|
||||||
|
else:
|
||||||
|
self.pool.execute(self.controller_id, "set_color",
|
||||||
|
self._xy_to_led_color(self._xy_color),
|
||||||
|
self.group)
|
||||||
|
|
||||||
|
# Brightness can be set independently of color
|
||||||
self.pool.execute(self.controller_id, "set_brightness",
|
self.pool.execute(self.controller_id, "set_brightness",
|
||||||
self._brightness / 255.0, self.group)
|
self._brightness / 255.0, self.group)
|
||||||
|
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user