I’m expanding the RFLink Cover module to contain the position and bind to Home Assistants functions to set the cover position.
My RFLink cover does not have a seperate “stop” funciton, you need to resend the direction it is going to stop it. So if it is closing you’ll need to send the close action again. The cover also does not provide any feedback, it is just using a one way protocol.
I calculate the position on the amount of time the cover is moving (I know how many seconds a specific cover will take to move from close to open). It is not nice, but it works nice.
Now I’m working on setting the cover position, this works until the cover needs to be stopped when it is in the correct position.
The _async_handle_command function doesn’t seem to get called,
the header of the function is as follow:
@asyncio.coroutine def _async_handle_command(self, command, *args):
This is the code I use to call the _async_handle_command function:
tmrCoverPosition = None def __init__(self,hass,device_id,**kwargs): super().__init__(hass,device_id,**kwargs) self.tmrCoverPosition = async_track_utc_time_change(self.hass, self.myCoroutine) async def myCoroutine(self,now): if (self.currentPosition < self.requestedPosition and self.lastMovementDirection == 'Open'): return self._async_handle_command("open_cover") def async_set_cover_position(self, **kwargs): if ATTR_POSITION in kwargs: position = float(kwargs[ATTR_POSITION]) position = min(100, max(0, position)) self.requestedPosition = position if (self.currentPosition < self.requestedPosition): return self.async_open_cover()
Can someone point me into the right direction on how I should get the function called?
Thanks