From 07469127ce308d5918c1024c019db9874d04e025 Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Mon, 1 Jun 2020 23:48:18 +0200 Subject: [PATCH] deCONZ - Add support for max/min mireds (#36355) * Add support for max/min mireds reported per light from deconz .77 * Bump dependency --- homeassistant/components/deconz/light.py | 10 ++++++++++ homeassistant/components/deconz/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/deconz/test_light.py | 4 ++++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/deconz/light.py b/homeassistant/components/deconz/light.py index 48d286266e4..566ab563ca5 100644 --- a/homeassistant/components/deconz/light.py +++ b/homeassistant/components/deconz/light.py @@ -130,6 +130,16 @@ class DeconzLight(DeconzDevice, LightEntity): return color_util.color_xy_to_hs(*self._device.xy) return None + @property + def max_mireds(self): + """Return the warmest color_temp that this light supports.""" + return self._device.ctmax or super().max_mireds + + @property + def min_mireds(self): + """Return the coldest color_temp that this light supports.""" + return self._device.ctmin or super().min_mireds + @property def is_on(self): """Return true if light is on.""" diff --git a/homeassistant/components/deconz/manifest.json b/homeassistant/components/deconz/manifest.json index e33af57099d..149ea5f1bc5 100644 --- a/homeassistant/components/deconz/manifest.json +++ b/homeassistant/components/deconz/manifest.json @@ -3,7 +3,7 @@ "name": "deCONZ", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/deconz", - "requirements": ["pydeconz==70"], + "requirements": ["pydeconz==71"], "ssdp": [ { "manufacturer": "Royal Philips Electronics" diff --git a/requirements_all.txt b/requirements_all.txt index b60a60be24f..d6bf6723f58 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1269,7 +1269,7 @@ pydaikin==2.1.1 pydanfossair==0.1.0 # homeassistant.components.deconz -pydeconz==70 +pydeconz==71 # homeassistant.components.delijn pydelijn==0.6.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c30e6745cbc..f8c3ef31090 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -545,7 +545,7 @@ pycoolmasternet==0.0.4 pydaikin==2.1.1 # homeassistant.components.deconz -pydeconz==70 +pydeconz==71 # homeassistant.components.zwave pydispatcher==2.0.5 diff --git a/tests/components/deconz/test_light.py b/tests/components/deconz/test_light.py index 229c085916e..782b2bf494b 100644 --- a/tests/components/deconz/test_light.py +++ b/tests/components/deconz/test_light.py @@ -46,6 +46,8 @@ LIGHTS = { "uniqueid": "00:00:00:00:00:00:00:00-00", }, "2": { + "ctmax": 454, + "ctmin": 155, "id": "Tunable white light id", "name": "Tunable white light", "state": {"on": True, "colormode": "ct", "ct": 2500, "reachable": True}, @@ -111,6 +113,8 @@ async def test_lights_and_groups(hass): tunable_white_light = hass.states.get("light.tunable_white_light") assert tunable_white_light.state == "on" assert tunable_white_light.attributes["color_temp"] == 2500 + assert tunable_white_light.attributes["max_mireds"] == 454 + assert tunable_white_light.attributes["min_mireds"] == 155 assert tunable_white_light.attributes["supported_features"] == 2 on_off_light = hass.states.get("light.on_off_light")