Skip to content
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

Not working with newest firmware version 3.3.9_003073 #14

Closed
ultrara1n opened this issue Jun 6, 2017 · 22 comments
Closed

Not working with newest firmware version 3.3.9_003073 #14

ultrara1n opened this issue Jun 6, 2017 · 22 comments

Comments

@ultrara1n
Copy link

Using this great code till today, after Xiaomi had to change the way of communication.
Getting the following result when just trying to get info data from vacuum:

ERROR:mirobo.vacuum:got error when receiving: timed out
Traceback (most recent call last):
File "/usr/local/bin/mirobo", line 11, in
sys.exit(cli())
File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 1043, in invoke
return Command.invoke(self, ctx)
File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/mirobo/cli.py", line 46, in cli
ctx.invoke(status)
File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/mirobo/cli.py", line 59, in status
res = vac.status()
File "/usr/local/lib/python3.4/dist-packages/mirobo/vacuum.py", line 150, in status
return VacuumStatus(self.send("get_status")[0])
File "/usr/local/lib/python3.4/dist-packages/mirobo/vacuum.py", line 121, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

@jcastro
Copy link

jcastro commented Jun 6, 2017

umm it's working for me! maybe the token changed or something else?

@ultrara1n
Copy link
Author

Have you updated your vacuum to the latest Firmware version? According to http://www.roboter-forum.com/showthread.php?18995-Neues-Firmware-Update!&p=254656&viewfull=1#post254656 there was a change for the sent packages to the robot. They are now signed with a timestamp to dismiss too old packages. The token haven't changed, because the App of the User from the linked Post ist already working, after updating to the newest Version.

@SchumyHao
Copy link
Contributor

@rytilahti I think you can take a look my pull request. I fixed the timestamp issue

@jcastro
Copy link

jcastro commented Jun 7, 2017

@ultrara1n yeah I did (see image below). Aside from these errors, which I was getting them before the update, everything seems to work as usual

2017-06-07 10:17:28 ERROR (<concurrent.futures.thread.ThreadPoolExecutor object at 0x2ba90ccbed30>_5) [mirobo.vacuum] got error when receiving: timed out 2017-06-07 10:17:28 ERROR (<concurrent.futures.thread.ThreadPoolExecutor object at 0x2ba90ccbed30>_5) [custom_components.switch.xiaomi_vacuum] Got exception while fetching the state: timed out

img_5502

@rytilahti
Copy link
Owner

@jcastro maybe your clock on the vacuum is also in correct time? Currently we are sending the current timestamp out, which could explain why it is working.

@SchumyHao do you mind rebasing that change on the current HEAD, or should I just incorporate "replaying" the device timestamp + some short delay?

@jcastro
Copy link

jcastro commented Jun 7, 2017

@rytilahti umm just checked it and it seems fine! Also checked my docker installation and it's also correct

root@unBeast:/usr/src/app# date
Wed Jun  7 12:14:25 CEST 2017
root@unBeast:/usr/src/app# 

@rytilahti
Copy link
Owner

rytilahti commented Jun 7, 2017

@jcastro yes, but does the robot return something similar? (when doing mirobo -d or -dd) Mine (which has no internet access) reports: ts = 1970-01-01 15:55:39

@SchumyHao
Copy link
Contributor

@rytilahti I'll create a new pull request later.
Because after you refactoring the code, my early pull request has merge conflict.

@rytilahti
Copy link
Owner

@SchumyHao ok, thanks! Please also take a note on my commentary on the code parts. I think it should be enough just to save the timestamp returned in responses and increment it with timedelta for a bit.

@jcastro
Copy link

jcastro commented Jun 7, 2017

@rytilahti yep!

value = Container: 
            ts = 2017-06-07 12:31:32

@chrostek
Copy link

any news here? my mirobo still does not work with this script with firmware 3.3.9 (worked with older one).
the patch from rytilahti also does not work for me. with the original script the
ts is correct (localtime), with the patch from rytilahti the ts is+2h (utc+4, localtime+2) my localtime is "Europe/Berlin (CEST, +0200)"

@chrostek
Copy link

iobroker-community-adapters/ioBroker.mihome-vacuum@2e28df0

it seems that there was a protocol change with 3.3.9

@chrostek
Copy link

chrostek commented Jul 4, 2017

@ultrara1n can you try to discover the token via one of this ways: https://github.com/ioBroker/ioBroker.mihome-vacuum#konfiguration
in my case the token discovered via the python script was wrong (i have done a complete reset and discovered new after the firmware update). the token in the sqlite database (iOS) was another one. with the other one the communication works again ...

@ultrara1n
Copy link
Author

@chrostek: I'm the creator of the MiToolkit (see my repo) :D
But I think It could have something to do with my raspberry, will try it on Windows later.

@rytilahti
Copy link
Owner

@chrostek, There's #15 which does seem to work sometimes but I haven't been able to make it work consistently all the time, so I'm still looking for a proper way to fix this.

@chrostek
Copy link

chrostek commented Jul 6, 2017

@rytilahti i moved to:
https://marketplace.eclipse.org/content/openhab-xiaomi-vacuum-binding
it works with the token from the sqlite db from iOS. the python script does not work anymore. but i dont need it anymore. thanks for the info

@rytilahti
Copy link
Owner

@chrostek glad to hear you got it working. Looks like it's not anymore possible to read the token out from the robot itself.

Anyway, thanks to #21 I realized that the id generation is the problem and I got the cli tool working again by not reusing the same 'id' for communication (the robot answers once per 'id' in a specific time-frame.

@TribuneX
Copy link

TribuneX commented Jul 6, 2017

So for now there is no way to get the token with the latest firmware anymore. Too bad that I just updated before extracting it.

@rytilahti
Copy link
Owner

rytilahti commented Jul 6, 2017

@TribuneX you can supposedly still extract the token from already paired device but I have not tested it.

@TribuneX
Copy link

TribuneX commented Jul 6, 2017

@rytilahti Do you have a link to some documentation who I can extract it from paired devices. I am using the iOS app.

@rytilahti
Copy link
Owner

@TribuneX some possible ways can be seen in this issue: aholstenson/miio#40 (comment)

@TribuneX
Copy link

TribuneX commented Jul 8, 2017

@rytilahti Thanks! I was able to extract the token from the sqlite file within my iOS backup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants