From 21872c42fef91e0404299ebbe7deaa9cd7eb86ed Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Wed, 28 Apr 2021 22:31:40 +0200 Subject: [PATCH] Fix color setting in LIFX services (#49822) --- homeassistant/components/lifx/light.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/homeassistant/components/lifx/light.py b/homeassistant/components/lifx/light.py index 9f1c5747aa8..e366b810a94 100644 --- a/homeassistant/components/lifx/light.py +++ b/homeassistant/components/lifx/light.py @@ -200,6 +200,12 @@ def find_hsbk(hass, **kwargs): if ATTR_HS_COLOR in kwargs: hue, saturation = kwargs[ATTR_HS_COLOR] + elif ATTR_RGB_COLOR in kwargs: + hue, saturation = color_util.color_RGB_to_hs(*kwargs[ATTR_RGB_COLOR]) + elif ATTR_XY_COLOR in kwargs: + hue, saturation = color_util.color_xy_to_hs(*kwargs[ATTR_XY_COLOR]) + + if hue is not None: hue = int(hue / 360 * 65535) saturation = int(saturation / 100 * 65535) kelvin = 3500