Skip to content
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

Fix Dynalite to explicitly check valid device class #36418

Merged
merged 3 commits into from Jun 4, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions homeassistant/components/dynalite/cover.py
Expand Up @@ -5,6 +5,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback

from .const import DEFAULT_COVER_CLASS
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved
from .dynalitebase import DynaliteBase, async_setup_entry_base


Expand All @@ -31,8 +32,10 @@ class DynaliteCover(DynaliteBase, CoverEntity):
def device_class(self) -> str:
"""Return the class of the device."""
dev_cls = self._device.device_class
assert dev_cls in DEVICE_CLASSES
return dev_cls
ret_val = DEFAULT_COVER_CLASS
if dev_cls in DEVICE_CLASSES:
ret_val = dev_cls
return ret_val

@property
def current_cover_position(self) -> int:
Expand Down