From d68f59ca6c91072988faa0ab756719ce632c6a07 Mon Sep 17 00:00:00 2001
From: Anders Melchiorsen <amelchio@nogoto.net>
Date: Wed, 3 May 2017 00:05:11 +0200
Subject: [PATCH] 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.
---
 homeassistant/components/light/lifx/effects.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/homeassistant/components/light/lifx/effects.py b/homeassistant/components/light/lifx/effects.py
index f4e598d9ce4..7904529bda3 100644
--- a/homeassistant/components/light/lifx/effects.py
+++ b/homeassistant/components/light/lifx/effects.py
@@ -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 = {