diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 3bb2b1ab239..ab39474c093 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -96,6 +96,7 @@ FLASH_LONG = "long" # Apply an effect to the light, can be EFFECT_COLORLOOP ATTR_EFFECT = "effect" EFFECT_COLORLOOP = "colorloop" +EFFECT_WHITE = "white" LIGHT_PROFILES_FILE = "light_profiles.csv" @@ -156,7 +157,7 @@ def turn_off(hass, entity_id=None, transition=None): hass.services.call(DOMAIN, SERVICE_TURN_OFF, data) -# pylint: disable=too-many-branches, too-many-locals +# pylint: disable=too-many-branches, too-many-locals, too-many-statements def setup(hass, config): """ Exposes light control via statemachine and services. """ @@ -282,6 +283,8 @@ def setup(hass, config): if ATTR_EFFECT in dat: if dat[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: light.turn_on(**params) diff --git a/homeassistant/components/light/limitlessled.py b/homeassistant/components/light/limitlessled.py index b35ed379047..0e2ce2230ac 100644 --- a/homeassistant/components/light/limitlessled.py +++ b/homeassistant/components/light/limitlessled.py @@ -18,7 +18,8 @@ import logging from homeassistant.const import DEVICE_DEFAULT_NAME 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 _LOGGER = logging.getLogger(__name__) @@ -159,10 +160,21 @@ class RGBWLimitlessLED(LimitlessLED): if ATTR_XY_COLOR in kwargs: self._xy_color = kwargs[ATTR_XY_COLOR] - self.pool.execute(self.controller_id, "set_color", - self._xy_to_led_color(self._xy_color), self.group) + effect = kwargs.get(ATTR_EFFECT) + + if effect == EFFECT_COLORLOOP: + self.pool.execute(self.controller_id, "disco", self.group) + elif 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._brightness / 255.0, self.group) + self.update_ha_state()