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.
This commit is contained in:
Anders Melchiorsen 2017-03-05 11:11:33 +01:00 committed by Pascal Vizeli
parent 7655b6271d
commit 7774f0ae53

View File

@ -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."""