From 64ea13104e6c6e248871e47ac4136360ec032698 Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Tue, 9 Apr 2019 05:48:17 -0400 Subject: [PATCH] Fix ZHA Light color conversion. (#22909) --- homeassistant/components/zha/core/channels/lighting.py | 1 + homeassistant/components/zha/light.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zha/core/channels/lighting.py b/homeassistant/components/zha/core/channels/lighting.py index c7cbdc67db9..0a96b4db4b8 100644 --- a/homeassistant/components/zha/core/channels/lighting.py +++ b/homeassistant/components/zha/core/channels/lighting.py @@ -29,6 +29,7 @@ class ColorChannel(ZigbeeChannel): async def async_configure(self): """Configure channel.""" await self.fetch_color_capabilities(False) + await super().async_configure() async def async_initialize(self, from_cache): """Initialize channel.""" diff --git a/homeassistant/components/zha/light.py b/homeassistant/components/zha/light.py index eadc9e03af0..12bc12c5f6e 100644 --- a/homeassistant/components/zha/light.py +++ b/homeassistant/components/zha/light.py @@ -266,7 +266,9 @@ class Light(ZhaEntity, light.Light): 'current_x', from_cache=from_cache) color_y = await self._color_channel.get_attribute_value( 'current_y', from_cache=from_cache) - self._hs_color = color_util.color_xy_to_hs(color_x, color_y) + if color_x is not None and color_y is not None: + self._hs_color = color_util.color_xy_to_hs( + float(color_x / 65535), float(color_y / 65535)) async def refresh(self, time): """Call async_get_state at an interval."""