Fix yeelight nightlight mode (#56363)

pull/56376/head
J. Nick Koston 2021-09-17 19:26:25 -10:00 committed by GitHub
parent eb98ac9415
commit b6763c7245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -71,8 +71,8 @@ ACTION_RECOVER = "recover"
ACTION_STAY = "stay"
ACTION_OFF = "off"
ACTIVE_MODE_NIGHTLIGHT = "1"
ACTIVE_COLOR_FLOWING = "1"
ACTIVE_MODE_NIGHTLIGHT = 1
ACTIVE_COLOR_FLOWING = 1
NIGHTLIGHT_SWITCH_TYPE_LIGHT = "light"
@ -618,7 +618,7 @@ class YeelightDevice:
# Only ceiling lights have active_mode, from SDK docs:
# active_mode 0: daylight mode / 1: moonlight mode (ceiling light only)
if self._active_mode is not None:
return self._active_mode == ACTIVE_MODE_NIGHTLIGHT
return int(self._active_mode) == ACTIVE_MODE_NIGHTLIGHT
if self._nightlight_brightness is not None:
return int(self._nightlight_brightness) > 0
@ -628,7 +628,7 @@ class YeelightDevice:
@property
def is_color_flow_enabled(self) -> bool:
"""Return true / false if color flow is currently running."""
return self._color_flow == ACTIVE_COLOR_FLOWING
return int(self._color_flow) == ACTIVE_COLOR_FLOWING
@property
def _active_mode(self):