Fix nanoleaf attribute when running an effect (#36794)

pull/36860/head
N1c093 2020-06-15 18:17:54 +02:00 committed by GitHub
parent 1b6f0b78aa
commit 717a21dc7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -230,7 +230,6 @@ class NanoleafLight(LightEntity):
try:
self._available = self._light.available
self._brightness = self._light.brightness
self._color_temp = self._light.color_temperature
self._effects_list = self._light.effects
# Nanoleaf api returns non-existent effect named "*Solid*" when light set to solid color.
# This causes various issues with scening (see https://github.com/home-assistant/core/issues/36359).
@ -238,7 +237,12 @@ class NanoleafLight(LightEntity):
self._effect = (
self._light.effect if self._light.effect in self._effects_list else None
)
self._hs_color = self._light.hue, self._light.saturation
if self._effect is None:
self._color_temp = self._light.color_temperature
self._hs_color = self._light.hue, self._light.saturation
else:
self._color_temp = None
self._hs_color = None
self._state = self._light.on
except Unavailable as err:
_LOGGER.error("Could not update status for %s (%s)", self.name, err)