-
-
Notifications
You must be signed in to change notification settings - Fork 595
Description
Before I begin, I am not very well versed in Python or the miio protocol... But here goes:
When ever I would try to execute any commands / pull any info from my STYTJ01ZHM, miiocli would take quite some time to execute the request... 10-15 seconds, and sometimes, it would even fail out right.
When using the -d flag I noticed that there was quite a few retries:
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 1
To fix this I modified miioprotocol.py with the following change:
self.__id += 1
to
self.__id += random.randint(1,100)
With this I am able to avoid retries and the replies to the commands happen on first request. Obviously with a range of 1 - 100 there is a chance that a recently used id will be selected again... But I am unsure what the range for the ids is and 1 - 100 works for the 1 / 60 second status polling I do and whatever actions I send to the vacuum.
Not sure if this breaks things... But in my case it works. Big guess here, but I am guessing that the fairly consistent list of ids that miiocli uses (1, 102, 203, etc...) are occupied / locked, and the vacuum refuses to answer on these recently used ids? Guessing here...