|
13 | 13 | import homeassistant.util.color as color_util |
14 | 14 | from homeassistant.components.light import ( |
15 | 15 | ATTR_BRIGHTNESS, |
16 | | - ATTR_COLOR_TEMP, |
| 16 | + ATTR_COLOR_TEMP_KELVIN, |
17 | 17 | ATTR_EFFECT, |
18 | 18 | ATTR_HS_COLOR, |
19 | 19 | ColorMode, |
| 20 | + DEFAULT_MAX_KELVIN, |
| 21 | + DEFAULT_MIN_KELVIN, |
20 | 22 | DOMAIN as LIGHT_DOMAIN, |
21 | 23 | LightEntity, |
22 | 24 | LightEntityFeature, |
@@ -91,6 +93,9 @@ async def async_setup_entry( |
91 | 93 |
|
92 | 94 | class ArloLight(LightEntity): |
93 | 95 |
|
| 96 | + _attr_min_color_temp_kelvin = DEFAULT_MIN_KELVIN |
| 97 | + _attr_max_color_temp_kelvin = DEFAULT_MAX_KELVIN |
| 98 | + |
94 | 99 | def __init__(self, light, aarlo_config): |
95 | 100 | """Initialize an Arlo light.""" |
96 | 101 |
|
@@ -185,6 +190,7 @@ def __init__(self, camera, aarlo_config): |
185 | 190 |
|
186 | 191 | self._attr_brightness = None |
187 | 192 | self._attr_color_temp = None |
| 193 | + self._attr_color_temp_kelvin = None |
188 | 194 | self._attr_effect = None |
189 | 195 | self._attr_effect_list = [LIGHT_EFFECT_NONE, LIGHT_EFFECT_RAINBOW] |
190 | 196 | self._attr_hs_color = None |
@@ -221,6 +227,7 @@ def _set_light_mode(self, light_mode): |
221 | 227 | self._attr_color_mode = ColorMode.HS |
222 | 228 | elif mode == "temperature": |
223 | 229 | temperature = light_mode.get("temperature") |
| 230 | + self._attr_color_temp_kevin = temperature |
224 | 231 | self._attr_color_temp = color_util.color_temperature_kelvin_to_mired(temperature) |
225 | 232 | self._attr_hs_color = color_util.color_temperature_to_hs(temperature) |
226 | 233 | self._attr_effect = LIGHT_EFFECT_NONE |
@@ -259,11 +266,8 @@ def turn_on(self, **kwargs): |
259 | 266 | rgb = color_util.color_hs_to_RGB(*kwargs[ATTR_HS_COLOR]) |
260 | 267 | self._light.set_nightlight_rgb(red=rgb[0], green=rgb[1], blue=rgb[2]) |
261 | 268 |
|
262 | | - if ATTR_COLOR_TEMP in kwargs: |
263 | | - kelvin = color_util.color_temperature_mired_to_kelvin( |
264 | | - kwargs.get(ATTR_COLOR_TEMP) |
265 | | - ) |
266 | | - self._light.set_nightlight_color_temperature(kelvin) |
| 269 | + if ATTR_COLOR_TEMP_KELVIN in kwargs: |
| 270 | + self._light.set_nightlight_color_temperature(kwargs.get(ATTR_COLOR_TEMP_KELVIN)) |
267 | 271 |
|
268 | 272 | if ATTR_EFFECT in kwargs: |
269 | 273 | effect = kwargs[ATTR_EFFECT] |
|
0 commit comments