mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix Hue color state for missing xy (#14230)
This commit is contained in:
parent
8b13658d3b
commit
bf056b6f01
@ -245,7 +245,7 @@ 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 in ('xy', 'hs'):
|
if mode in ('xy', 'hs') and 'xy' in source:
|
||||||
return color.color_xy_to_hs(*source['xy'])
|
return color.color_xy_to_hs(*source['xy'])
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -650,6 +650,19 @@ 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 is None
|
||||||
|
|
||||||
light = hue_light.HueLight(
|
light = hue_light.HueLight(
|
||||||
light=Mock(state={
|
light=Mock(state={
|
||||||
'colormode': 'xy',
|
'colormode': 'xy',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user