Skip to content

Commit

Permalink
Fix wrong light state #465
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 3, 2024
1 parent ff6453b commit e2424a9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions custom_components/yandex_station/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,14 @@ def internal_update(self, capabilities: dict, properties: dict):

# check if color exists in update
if "color" in capabilities:
# check if color not null
if item := capabilities["color"]:
try:
# fix https://github.com/AlexxIT/YandexStation/issues/465
item = capabilities["color"]
self._attr_hs_color = (item["value"]["h"], item["value"]["s"])
self._attr_effect = item["name"]
# check if color value exists
if value := item.get("value"):
self._attr_hs_color = (value["h"], value["s"])
else:
self._attr_hs_color = None
else:
self._attr_effect = None
except:
self._attr_hs_color = None
self._attr_effect = None

async def async_turn_on(
self,
Expand Down

0 comments on commit e2424a9

Please sign in to comment.