8000 Fix nightlight support detection by zewelor · Pull Request #36656 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix nightlight support detection #36656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2020
Merged
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
< 8000 div class="js-unified-diff-view">
Diff view
15 changes: 11 additions & 4 deletions homeassistant/components/yeelight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,12 @@ def model(self):

@property
def is_nightlight_supported(self) -> bool:
"""Return true / false if nightlight is supported."""
if self.model:
return self.bulb.get_model_specs().get("night_light", False)
"""
Return true / false if nightlight is supported.

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

@property
Expand Down Expand Up @@ -333,6 +334,12 @@ def _get_capabilities(self):
"""Request device capabilities."""
try:
self.bulb.get_capabilities()
_LOGGER.debug(
"Device %s, %s capabilities: %s",
self.ipaddr,
self.name,
self.bulb.capabilities,
)
except BulbException as ex:
_LOGGER.error(
"Unable to get device capabilities %s, %s: %s",
Expand Down
0