TomFaulkner / SenseMe

Python Library for Haiku SenseMe app controlled fans/lights
GNU General Public License v3.0
21 stars 10 forks source link

Issues due to not waiting for responses #38

Open TomFaulkner opened 6 years ago

TomFaulkner commented 6 years ago

Given the way this library is communicating with the fan, specifically the receiving messages after sending a command portion, very quickly polling after sending a command can result in receiving the response to the command rather than the response to the poll, and attempting to return that.

Workarounds are being used for the two most likely methods where this would become evident, speed and brightness.

Documented in issues #19, #37.

While it would be slower, the proper way to fix this is probably to wait for the response to the command, and returning based on that rather than fire and forget. Another option would be to verify that the received response to any query is actually a response to that query. This would be faster, but might be more effort.

Both probably need to happen, assuming the former doesn't slow things down much, which I don't think it will.

A fix for this may lead to breaking changes and a major version bump.