diff --git a/homeassistant/components/broadlink/light.py b/homeassistant/components/broadlink/light.py index 57797ca592a..fde6d322bc6 100644 --- a/homeassistant/components/broadlink/light.py +++ b/homeassistant/components/broadlink/light.py @@ -6,7 +6,7 @@ from broadlink.exceptions import BroadlinkException from homeassistant.components.light import ( ATTR_BRIGHTNESS, - ATTR_COLOR_TEMP, + ATTR_COLOR_TEMP_KELVIN, ATTR_HS_COLOR, ColorMode, LightEntity, @@ -45,6 +45,8 @@ class BroadlinkLight(BroadlinkEntity, LightEntity): _attr_has_entity_name = True _attr_name = None + _attr_min_color_temp_kelvin = 2700 + _attr_max_color_temp_kelvin = 6500 def __init__(self, device): """Initialize the light.""" @@ -79,7 +81,7 @@ class BroadlinkLight(BroadlinkEntity, LightEntity): self._attr_hs_color = [data["hue"], data["saturation"]] if "colortemp" in data: - self._attr_color_temp = round((data["colortemp"] - 2700) / 100 + 153) + self._attr_color_temp_kelvin = data["colortemp"] if "bulb_colormode" in data: if data["bulb_colormode"] == BROADLINK_COLOR_MODE_RGB: @@ -107,9 +109,9 @@ class BroadlinkLight(BroadlinkEntity, LightEntity): state["saturation"] = int(hs_color[1]) state["bulb_colormode"] = BROADLINK_COLOR_MODE_RGB - elif ATTR_COLOR_TEMP in kwargs: - color_temp = kwargs[ATTR_COLOR_TEMP] - state["colortemp"] = (color_temp - 153) * 100 + 2700 + elif ATTR_COLOR_TEMP_KELVIN in kwargs: + color_temp = kwargs[ATTR_COLOR_TEMP_KELVIN] + state["colortemp"] = color_temp state["bulb_colormode"] = BROADLINK_COLOR_MODE_WHITE await self._async_set_state(state)