improvements to zha cover (#31144)

pull/31161/head
Bill Durr 2020-01-25 13:20:59 -05:00 committed by Charles Garwood
parent 217e280f8b
commit e16e192b3c
1 changed files with 11 additions and 1 deletions

View File

@ -95,6 +95,16 @@ class ZhaCover(ZhaEntity, CoverDevice):
return None
return self.current_cover_position == 0
@property
def is_opening(self):
"""Return if the cover is opening or not."""
return self._state == STATE_OPENING
@property
def is_closing(self):
"""Return if the cover is closing or not."""
return self._state == STATE_CLOSING
@property
def current_cover_position(self):
"""Return the current position of ZHA cover.
@ -133,7 +143,7 @@ class ZhaCover(ZhaEntity, CoverDevice):
async def async_set_cover_position(self, **kwargs):
"""Move the roller shutter to a specific position."""
new_pos = kwargs.get(ATTR_POSITION)
new_pos = kwargs[ATTR_POSITION]
res = await self._cover_channel.go_to_lift_percentage(100 - new_pos)
if isinstance(res, list) and res[1] is Status.SUCCESS:
self.async_set_state(