Fix nightlight support detection (#36656)

This commit is contained in:
zewelor 2020-06-12 00:46:00 +02:00 committed by GitHub
parent d4d233536f
commit 986853d497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,11 +239,12 @@ class YeelightDevice:
@property @property
def is_nightlight_supported(self) -> bool: def is_nightlight_supported(self) -> bool:
"""Return true / false if nightlight is supported.""" """
if self.model: Return true / false if nightlight is supported.
return self.bulb.get_model_specs().get("night_light", False)
Uses brightness as it appears to be supported in both ceiling and other lights.
"""
# It should support both ceiling and other lights
return self._nightlight_brightness is not None return self._nightlight_brightness is not None
@property @property
@ -333,6 +334,12 @@ class YeelightDevice:
"""Request device capabilities.""" """Request device capabilities."""
try: try:
self.bulb.get_capabilities() self.bulb.get_capabilities()
_LOGGER.debug(
"Device %s, %s capabilities: %s",
self.ipaddr,
self.name,
self.bulb.capabilities,
)
except BulbException as ex: except BulbException as ex:
_LOGGER.error( _LOGGER.error(
"Unable to get device capabilities %s, %s: %s", "Unable to get device capabilities %s, %s: %s",