I browsed the light component and lifx platform code a bit and I’ll admit I don’t fully understand how they use all these different representations of color.
It looks like when using the light.turn_on service that you can only use one of profile, color_name, hs_color, xy_color, rgb_color, color_temp or kelvin. Then the code converts as necessary. E.g., in the light component code, profile, color_name, xy_color and rgb_color all seem to ultimately get converted to hs_color. Also, kelvin gets converted to color_temp. So ultimately, only hs_color or color_temp is used (again, after possibly being converted from another input value), but not both. Then in the lifx code it further converts either hs_color or color_temp (depending on which was provided) to hue/saturation/kelvin, and that is apparently what it uses to set the color of the bulb.
Then when setting the entity’s attributes, the lifx platform sets hs_color and color_temp (based on the color it set), and the light component adds xy_color and rgb_color (converted from hs_color.)
Now I’m no color expert, but from the little I researched, I don’t see how a color_temp of 363 is equivalent to an hs_color of 0,0.
In any case, I think the bottom line is you’re setting the color via color_temp (or possibly via kelvin that gets converted to color_temp), and the lifx platform is representing that with an hs_color that is not equivalent. Then my script saves and restores (the invalid) hs_color, resulting in an incorrect color_temp. Of course, I could still be misreading things. If someone knows more about this, maybe they can help.
But, at least for now, assuming I’m correct that you’re using color_temp or kelvin when turning the light on, then I would suggest making a minor change to my script. I.e., change the following:
# Select light attributes to save/restore.
ATTR_BRIGHTNESS = "brightness"
ATTR_HS_COLOR = "hs_color"
LIGHT_ATTRS = [ATTR_BRIGHTNESS, ATTR_HS_COLOR]
to:
# Select light attributes to save/restore.
ATTR_BRIGHTNESS = "brightness"
ATTR_COLOR_TEMP = "color_temp"
LIGHT_ATTRS = [ATTR_BRIGHTNESS, ATTR_COLOR_TEMP]
If that works, and someone can fill in a bit more about the relationship between hs_color and color_temp, then there might be a more elegant way for my script to handle this situation.