mileperhour / localtuya-homeassistant

local handling for Tuya devices
GNU General Public License v3.0
147 stars 667 forks source link

Cover fake positioning revised #18

Closed rospogrigio closed 3 years ago

rospogrigio commented 3 years ago

Since we now have "push" notifications for state changes, it is possible to slightly improve the "fake" positioning for covers, since we are aware also of physical buttons usage. This PR tracks the status of the cover, and in case it is opening or closing it updates the "fake" position by measuring the elapsed time between the open/close and the stop command, with respect to a full opening time. We still keep the "double range" mechanism (i.e., the initial position is 50, and a 50-movement correspond to a full opening/closing), because it is still not possible to know the real initial position at startup.