Fix Hue color state for missing xy (#14230)
This commit is contained in:
1 parent
8b13658d3b
commit
bf056b6f01
2 files changed
+14
-1
No files matched your search
@@ -245,7 +245,7 @@ class HueLight(Light):
|
||||
mode = self._color_mode
|
||||
source = self.light.action if self.is_group else self.light.state
|
||||
|
||||
if mode in ('xy', 'hs'):
|
||||
if mode in ('xy', 'hs') and 'xy' in source:
|
||||
return color.color_xy_to_hs(*source['xy'])
|
||||
|
||||
return None
|
||||
|
||||
@@ -650,6 +650,19 @@ def test_hs_color():
|
||||
|
||||
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 is None
|
||||
|
||||
light = hue_light.HueLight(
|
||||
light=Mock(state={
|
||||
'colormode': 'xy',
|
||||
|
||||
Reference in new issue
Block a user