Short handed device class for overkiz cover (#100394)

This commit is contained in:
Jan Bouwhuis 2023-09-14 18:10:31 +02:00 committed by GitHub
parent 89eec9990b
commit 8b7061b634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,17 @@ OVERKIZ_DEVICE_TO_DEVICE_CLASS = {
class VerticalCover(OverkizGenericCover):
"""Representation of an Overkiz vertical cover."""
def __init__(
self, device_url: str, coordinator: OverkizDataUpdateCoordinator
) -> None:
"""Initialize vertical cover."""
super().__init__(device_url, coordinator)
self._attr_device_class = (
OVERKIZ_DEVICE_TO_DEVICE_CLASS.get(self.device.widget)
or OVERKIZ_DEVICE_TO_DEVICE_CLASS.get(self.device.ui_class)
or CoverDeviceClass.BLIND
)
@property
def supported_features(self) -> CoverEntityFeature:
"""Flag supported features."""
@ -64,15 +75,6 @@ class VerticalCover(OverkizGenericCover):
return supported_features
@property
def device_class(self) -> CoverDeviceClass:
"""Return the class of the device."""
return (
OVERKIZ_DEVICE_TO_DEVICE_CLASS.get(self.device.widget)
or OVERKIZ_DEVICE_TO_DEVICE_CLASS.get(self.device.ui_class)
or CoverDeviceClass.BLIND
)
@property
def current_cover_position(self) -> int | None:
"""Return current position of cover.