Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/light/hue.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def hs_color(self):
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
Expand Down
13 changes: 13 additions & 0 deletions tests/components/light/test_hue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down