diff --git a/homeassistant/components/dynalite/cover.py b/homeassistant/components/dynalite/cover.py index 96a1f41f9e3..2bac51e0b8b 100644 --- a/homeassistant/components/dynalite/cover.py +++ b/homeassistant/components/dynalite/cover.py @@ -12,6 +12,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.util.enum import try_parse_enum +from .bridge import DynaliteBridge from .dynalitebase import DynaliteBase, async_setup_entry_base @@ -23,7 +24,7 @@ async def async_setup_entry( """Record the async_add_entities function to add them later when received from Dynalite.""" @callback - def cover_from_device(device, bridge): + def cover_from_device(device: Any, bridge: DynaliteBridge) -> CoverEntity: if device.has_tilt: return DynaliteCoverWithTilt(device, bridge) return DynaliteCover(device, bridge) @@ -36,11 +37,11 @@ async def async_setup_entry( class DynaliteCover(DynaliteBase, CoverEntity): """Representation of a Dynalite Channel as a Home Assistant Cover.""" - @property - def device_class(self) -> CoverDeviceClass: - """Return the class of the device.""" + def __init__(self, device: Any, bridge: DynaliteBridge) -> None: + """Initialize the cover.""" + super().__init__(device, bridge) device_class = try_parse_enum(CoverDeviceClass, self._device.device_class) - return device_class or CoverDeviceClass.SHUTTER + self._attr_device_class = device_class or CoverDeviceClass.SHUTTER @property def current_cover_position(self) -> int: