mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 21:25:13 +02:00
Use attributes
This commit is contained in:
@@ -125,6 +125,9 @@ async def async_setup_platform(
|
||||
class RflinkCover(RflinkCommand, CoverEntity, RestoreEntity):
|
||||
"""Rflink entity which can switch on/stop/off (eg: cover)."""
|
||||
|
||||
_attr_assumed_state = True
|
||||
_attr_should_poll = False
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Restore RFLink cover state (OPEN/CLOSE)."""
|
||||
await super().async_added_to_hass()
|
||||
@@ -141,21 +144,11 @@ class RflinkCover(RflinkCommand, CoverEntity, RestoreEntity):
|
||||
elif command in ["off", "alloff", "down"]:
|
||||
self._state = False
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""No polling available in RFlink cover."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def is_closed(self) -> bool | None:
|
||||
"""Return if the cover is closed."""
|
||||
return not self._state
|
||||
|
||||
@property
|
||||
def assumed_state(self) -> bool:
|
||||
"""Return True because covers can be stopped midway."""
|
||||
return True
|
||||
|
||||
async def async_close_cover(self, **kwargs: Any) -> None:
|
||||
"""Turn the device close."""
|
||||
await self._async_handle_command("close_cover")
|
||||
|
Reference in New Issue
Block a user