Update LIFX default color for breathe/pulse effects (#7407)

First, move the default away from turn_on so we do not have to test for
the current service.

Next, change the default color away from random. The new default is that
saturated colors will flash white and desatured colors will flash to their
fully satured color. Always with full brightness.

After many experiments, this was the method that best produced results that
are both visually pleasing and always noticeable as a flash.
pull/7396/head
Anders Melchiorsen 2017-05-03 00:05:11 +02:00 committed by GitHub
parent 4d52b0ecd5
commit d68f59ca6c
1 changed files with 8 additions and 8 deletions

View File

@ -131,13 +131,6 @@ def default_effect(light, **kwargs):
data = {
ATTR_ENTITY_ID: light.entity_id,
}
if service in (SERVICE_EFFECT_BREATHE, SERVICE_EFFECT_PULSE):
data[ATTR_RGB_COLOR] = [
random.randint(1, 127),
random.randint(1, 127),
random.randint(1, 127),
]
data[ATTR_BRIGHTNESS] = 255
yield from light.hass.services.async_call(DOMAIN, service, data)
@ -237,7 +230,14 @@ class LIFXEffectBreathe(LIFXEffect):
"""Play a light effect on the bulb."""
period = kwargs[ATTR_PERIOD]
cycles = kwargs[ATTR_CYCLES]
hsbk, _ = light.find_hsbk(**kwargs)
hsbk, color_changed = light.find_hsbk(**kwargs)
# Default color is to fully (de)saturate with full brightness
if not color_changed:
if hsbk[1] > 65536/2:
hsbk = [hsbk[0], 0, 65535, 4000]
else:
hsbk = [hsbk[0], 65535, 65535, hsbk[3]]
# Start the effect
args = {