Cleanup supported_features in smartthings cover (#82240)

This commit is contained in:
epenet 2022-11-17 08:32:42 +01:00 committed by GitHub
parent c999953514
commit 6856374f24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,8 +70,6 @@ def get_capabilities(capabilities: Sequence[str]) -> Sequence[str] | None:
class SmartThingsCover(SmartThingsEntity, CoverEntity): class SmartThingsCover(SmartThingsEntity, CoverEntity):
"""Define a SmartThings cover.""" """Define a SmartThings cover."""
_attr_supported_features: int
def __init__(self, device): def __init__(self, device):
"""Initialize the cover class.""" """Initialize the cover class."""
super().__init__(device) super().__init__(device)
@ -102,7 +100,7 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity):
async def async_set_cover_position(self, **kwargs: Any) -> None: async def async_set_cover_position(self, **kwargs: Any) -> None:
"""Move the cover to a specific position.""" """Move the cover to a specific position."""
if not self._attr_supported_features & CoverEntityFeature.SET_POSITION: if not self.supported_features & CoverEntityFeature.SET_POSITION:
return return
# Do not set_status=True as device will report progress. # Do not set_status=True as device will report progress.
await self._device.set_level(kwargs[ATTR_POSITION], 0) await self._device.set_level(kwargs[ATTR_POSITION], 0)
@ -144,7 +142,7 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity):
@property @property
def current_cover_position(self) -> int | None: def current_cover_position(self) -> int | None:
"""Return current position of cover.""" """Return current position of cover."""
if not self._attr_supported_features & CoverEntityFeature.SET_POSITION: if not self.supported_features & CoverEntityFeature.SET_POSITION:
return None return None
return self._device.status.level return self._device.status.level