Fixed Tradfri whitebulbs handling after #9703 (#10040)

This commit is contained in:
Maciej Sokołowski 2017-11-02 09:18:20 +01:00 committed by Lewis Juggins
parent 56c66a19f0
commit 1c2224cc5c

View File

@ -161,6 +161,7 @@ class TradfriLight(Light):
@property
def min_mireds(self):
"""Return the coldest color_temp that this light supports."""
if self._light_control.max_kelvin is not None:
return color_util.color_temperature_kelvin_to_mired(
self._light_control.max_kelvin
)
@ -168,6 +169,7 @@ class TradfriLight(Light):
@property
def max_mireds(self):
"""Return the warmest color_temp that this light supports."""
if self._light_control.min_kelvin is not None:
return color_util.color_temperature_kelvin_to_mired(
self._light_control.min_kelvin
)
@ -219,8 +221,10 @@ class TradfriLight(Light):
@property
def color_temp(self):
"""Return the CT color value in mireds."""
kelvin_color = self._light_data.kelvin_color_inferred
if kelvin_color is not None:
return color_util.color_temperature_kelvin_to_mired(
self._light_data.kelvin_color_inferred
kelvin_color
)
@property