Fix ZHA Light color conversion. (#22909)

This commit is contained in:
Alexei Chetroi 2019-04-09 05:48:17 -04:00 committed by Charles Garwood
parent 75bed93d3d
commit 64ea13104e
2 changed files with 4 additions and 1 deletions

View File

@ -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."""

View File

@ -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."""