-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite tilt and position calculation #6
Rewrite tilt and position calculation #6
Conversation
units are unsigned so they never go bellow 0 🤦
This is excellent, thank you. I will test over the weekend. If that works, I'll merge it. I thik if this is consistent with the core component, we might possibly try to make it part of the ESPHome standard integrations... |
Thanks. I don't think it suits the standard component since this is a very specific kind of cover, and it would have to be made more generic to merge it. Unless that would be a different type of cover for this specific use case that we have 🤔. |
@pawelma I've finally found the time to test it. I put that to a separate branch, so that I can switch between the two in ESPHome (just changing ref between master/test). |
Position updates are made but every 1 second AFFAIR. It can be changed I guess, but I wanted to reduce IO as it might make covers less accurate since it's synchronous. |
Hello 👋 .
Finally, found some time so raising PR related with issue #5 I raised week ago. I do understand that it does bring breaking changes and changes the philosophy of the current component, so if it doesn't suite this project, feel free to close the PR. I'm just raising for visibility ;).
WHAT
WHY
Previous implementation seemed not accurate enough, and I was unable to set deterministic
tilt
for my blinds.I used TimeBasedCover as a base, as its loop reads nicer than multiple conditions.
Also have other features in mind that I could build on top of this solution like: include interlock while switching from open/close to improve precision, keep tilt on position change, add motor build in 'endstop' config value, to allow going back to
0
tilt after small tilt increase when motor build in end stop has not been released yet (so we need to open tilt to release end stop and close).Notes
Tested on sonoff dual r3 and ESP32 node mcu.
Run time performance for
recalculate
function and according to ESPmillis()
it takes0
ms to calculate each round. Only time, consuming operation is publishing as it escapes out of the board, but changing that does not impact number ofloop
calls within constrained time.