Use shorthand attributes in shelly covers (#64829)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/64833/head
epenet 2022-01-24 11:31:50 +01:00 committed by GitHub
parent b8237e5ec9
commit a459cf8ca4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -47,9 +47,9 @@ class ShellyCover(ShellyBlockEntity, CoverEntity):
"""Initialize light."""
super().__init__(wrapper, block)
self.control_result: dict[str, Any] | None = None
self._supported_features: int = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
self._attr_supported_features: int = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
if self.wrapper.device.settings["rollers"][0]["positioning"]:
self._supported_features |= SUPPORT_SET_POSITION
self._attr_supported_features |= SUPPORT_SET_POSITION
@property
def is_closed(self) -> bool:
@ -83,11 +83,6 @@ class ShellyCover(ShellyBlockEntity, CoverEntity):
return self.block.roller == "open"
@property
def supported_features(self) -> int:
"""Flag supported features."""
return self._supported_features
async def async_close_cover(self, **kwargs: Any) -> None:
"""Close cover."""
self.control_result = await self.set_state(go="close")