Closed Apollon77 closed 1 year ago
@codetheweb I asked the user that is affected by the issue to check my branch. I tried to make it backward compatible and stumbled over the case that two parallel "set" in general would be an issue because in this case the setResolve variable is overwritten. I added a check and throw an error in that case. This is slightly breaking, but I think the much cleaner way. What do you think?
Yeah I think that makes sense.
Will merge once we get confirmation from the user.
@codetheweb I added another case that I stumbled over with a user (the device was just sending the REFRESH response, but did not sent any STATUS package in between, so we never resolved the promise. The usual process is
-> send DP_REFESH -> receive STATUS with data -> receive "empty" DP_REFRESH
But it seems that it also can happen like:
-> send DP_REFESH -> receive "empty" DP_REFRESH
without data. So I now check if the resolver is still there and resolve on DP_REFRESH too with the empty package.
A useris testing this right now...
@codetheweb Verified ... it seems we never really resolved for "refresh" (was only working when falling back to "set") ... we just emitted the data ... veeery interesting
Published in v7.5.2.
Also added you as a contributor to this repo
Thank you!
fixes #617 fixes https://github.com/codetheweb/tuyapi/discussions/613
This is untested currently!