Revert Hue color state to be xy-based (#14154)

This commit is contained in:
Anders Melchiorsen 2018-04-30 00:49:19 +02:00 committed by GitHub
parent aa8bd37143
commit 30d987f59f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 17 deletions

View File

@ -245,12 +245,9 @@ class HueLight(Light):
mode = self._color_mode mode = self._color_mode
source = self.light.action if self.is_group else self.light.state source = self.light.action if self.is_group else self.light.state
if mode == 'xy' and 'xy' in source: if mode in ('xy', 'hs'):
return color.color_xy_to_hs(*source['xy']) return color.color_xy_to_hs(*source['xy'])
if mode == 'hs' and 'hue' in source and 'sat' in source:
return source['hue'] / 65535 * 360, source['sat'] / 255 * 100
return None return None
@property @property

View File

@ -650,19 +650,6 @@ def test_hs_color():
assert light.hs_color is None assert light.hs_color is None
light = hue_light.HueLight(
light=Mock(state={
'colormode': 'hs',
'hue': 1234,
'sat': 123,
}),
request_bridge_update=None,
bridge=Mock(),
is_group=False,
)
assert light.hs_color == (1234 / 65535 * 360, 123 / 255 * 100)
light = hue_light.HueLight( light = hue_light.HueLight(
light=Mock(state={ light=Mock(state={
'colormode': 'xy', 'colormode': 'xy',