Make LIFX color/temperature attributes mutually exclusive (#15234)

This commit is contained in:
Anders Melchiorsen 2018-07-01 19:06:30 +02:00 committed by Paulus Schoutsen
parent 0a186650bf
commit dffe36761d

View File

@ -446,7 +446,9 @@ class LIFXLight(Light):
@property @property
def color_temp(self): def color_temp(self):
"""Return the color temperature.""" """Return the color temperature."""
kelvin = self.device.color[3] _, sat, _, kelvin = self.device.color
if sat:
return None
return color_util.color_temperature_kelvin_to_mired(kelvin) return color_util.color_temperature_kelvin_to_mired(kelvin)
@property @property
@ -601,7 +603,7 @@ class LIFXColor(LIFXLight):
hue, sat, _, _ = self.device.color hue, sat, _, _ = self.device.color
hue = hue / 65535 * 360 hue = hue / 65535 * 360
sat = sat / 65535 * 100 sat = sat / 65535 * 100
return (hue, sat) return (hue, sat) if sat else None
class LIFXStrip(LIFXColor): class LIFXStrip(LIFXColor):