From 7774f0ae53970b32602853aaed548a88b5694393 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Sun, 5 Mar 2017 11:11:33 +0100 Subject: [PATCH] Set new color before turning LIFX bulbs on (#6402) A LIFX bulb maintains its previous color even when the light is off. For example, if the previous color is blue and the bulb is turned on and then set to a red color, it will transition through purple colors. After this commit, the target color is set while the bulb is still turned off. This overrides the previous color and brightness that the bulb remembered. The light is then turned on with the requested transition duration. For the example, this gives the expected result of only going through red colors. --- homeassistant/components/light/lifx.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/light/lifx.py b/homeassistant/components/light/lifx.py index 039e22e73df..6b0c8a63f99 100644 --- a/homeassistant/components/light/lifx.py +++ b/homeassistant/components/light/lifx.py @@ -230,10 +230,12 @@ class LIFXLight(Light): hue, saturation, brightness, kelvin, fade) if self._power == 0: + self._liffylights.set_color(self._ip, hue, saturation, + brightness, kelvin, 0) self._liffylights.set_power(self._ip, 65535, fade) - - self._liffylights.set_color(self._ip, hue, saturation, - brightness, kelvin, fade) + else: + self._liffylights.set_color(self._ip, hue, saturation, + brightness, kelvin, fade) def turn_off(self, **kwargs): """Turn the device off."""