Add support for position on wink cover (#5751)

Add support for position property for wink covers and fix state when stopped in the middle.
This commit is contained in:
Alberto Arias Maestro 2017-02-06 05:43:36 -08:00 committed by andrey-git
parent 4cc711357a
commit 32dc276c53

View File

@ -40,13 +40,17 @@ class WinkCoverDevice(WinkDevice, CoverDevice):
"""Open the shade.""" """Open the shade."""
self.wink.set_state(1) self.wink.set_state(1)
def set_cover_position(self, position, **kwargs):
"""Move the roller shutter to a specific position."""
self.wink.set_state(float(position)/100)
@property
def current_cover_position(self):
"""Return the current position of roller shutter."""
return int(self.wink.state()*100)
@property @property
def is_closed(self): def is_closed(self):
"""Return if the cover is closed.""" """Return if the cover is closed."""
state = self.wink.state() state = self.wink.state()
if state == 0: return bool(state == 0)
return True
elif state == 1:
return False
else:
return None