diff --git a/homeassistant/components/dynalite/const.py b/homeassistant/components/dynalite/const.py index 82d66dba7ba..e5a4e90d1bd 100644 --- a/homeassistant/components/dynalite/const.py +++ b/homeassistant/components/dynalite/const.py @@ -1,7 +1,6 @@ """Constants for the Dynalite component.""" import logging -from homeassistant.components.cover import DEVICE_CLASS_SHUTTER from homeassistant.const import CONF_ROOM LOGGER = logging.getLogger(__package__) @@ -36,7 +35,6 @@ CONF_TILT_TIME = "tilt" CONF_TIME_COVER = "time_cover" DEFAULT_CHANNEL_TYPE = "light" -DEFAULT_COVER_CLASS = DEVICE_CLASS_SHUTTER DEFAULT_NAME = "dynalite" DEFAULT_PORT = 12345 DEFAULT_TEMPLATES = { diff --git a/homeassistant/components/dynalite/cover.py b/homeassistant/components/dynalite/cover.py index e44fd150f38..0673e07fc0d 100644 --- a/homeassistant/components/dynalite/cover.py +++ b/homeassistant/components/dynalite/cover.py @@ -1,12 +1,18 @@ """Support for the Dynalite channels as covers.""" from typing import Callable -from homeassistant.components.cover import DEVICE_CLASSES, CoverEntity +from homeassistant.components.cover import ( + DEVICE_CLASS_SHUTTER, + DEVICE_CLASSES, + CoverEntity, +) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from .dynalitebase import DynaliteBase, async_setup_entry_base +DEFAULT_COVER_CLASS = DEVICE_CLASS_SHUTTER + async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable @@ -31,8 +37,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: