Python plugin: Xiaomi Mi Robot Vacuum Topic is solved

Python and python framework

Moderator: leecollings

hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by hoeby »

RichardBokker wrote: Thursday 28 November 2019 9:49 Yes, IP is the same, that is fixed on router based on MAC-Adres.
Both vacuum cleaners have the same IP?
This can't work. Be sure, the don't have the same address
RichardBokker wrote: Thursday 28 November 2019 9:49 I had them on chinese server to get my token on old MiHome app + adb procedure.
Does the ID or Token change on new server? Should i keep the cleaners on chinese server?
I found that everytime you do something in the app. remove and add. Of switch between servers, that the token changes.
The token is not personalized to your vacuum cleaner
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
RichardBokker
Posts: 39
Joined: Thursday 09 April 2015 20:57
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9317
Location: Netherlands
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by RichardBokker »

hoeby wrote: Friday 29 November 2019 16:03
RichardBokker wrote: Thursday 28 November 2019 9:49 Yes, IP is the same, that is fixed on router based on MAC-Adres.
Both vacuum cleaners have the same IP?
This can't work. Be sure, the don't have the same address
RichardBokker wrote: Thursday 28 November 2019 9:49 I had them on Chinese server to get my token on old MiHome app + adb procedure.
Does the ID or Token change on new server? Should i keep the cleaners on Chinese server?
I found that every-time you do something in the app. remove and add. Of switch between servers, that the token changes.
The token is not personalised to your vacuum cleaner
Haha correct, both cleaners having their own unique IP of course. I just try to mention that IP was not changed during that time.

Your second quote is very useful. So apparently you cannot put a dutch server on, because you are not able to get the tokens in a adb backup in the older app version.

So in that case u should use an other server (i.a. singapore) and stay on it. thats bad :(
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by hoeby »

RichardBokker wrote: Friday 29 November 2019 19:19 thats bad :(
I share your thoughed. It is sad.
I changed everything from the gateway to zigbee2mqtt. But the vacuum cleaner doesn't without the chinese server.
It is that, or clean with your manual vacuum cleaner
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

is it possible to get it to work with zone cleaning?
mioiox
Posts: 1
Joined: Sunday 29 December 2019 18:57
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by mioiox »

Prutsium wrote: Monday 25 November 2019 9:06 Hi as my S5 Max would be arriving this week started to read a bit about this plugin.
Now i noticed all is based round the Mi Home app but as far as i know the S5 Max uses the Roborock app.

Is the guide then the same or wouldn't it work?
I am in the same situation (S5 Max and Roborock app). I tried* to find a way to extract the token from the ios Roborock app, but without success. I was also thinking of using both apps (Roborock and MiHome), however this most probably is not possible, since each of them wants the robot to be added. And the step of adding it will regenerate the token, presumably.

Has someone succeeded with this?

P.S. What I did so far:
1. Backed up iphone (don't have access to an Android, currently)
2. Opened backup using iBackup Viewer (free)
3. Browsed the branch com.roborock.smart and extracted every non-png file
3. Not many of those are readable. Probably the info in question resides within the index.ios.bundle file (which is around 3.5 MB), however I couldn't find anything useful (that looks like a hex token).

I (and others, I guess) would be really grateful for some insights!
macieiks
Posts: 36
Joined: Tuesday 07 July 2015 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by macieiks »

Hi,
I'm at the purchase stage of automatic vacuum cleaner. Checking this 13 page topic I see that Xiaomi would be a good solution when comparing price/quality/functionality ratio. As per description I see this plugin is based on original rytilahti python-miio library. Does it mean that it supports all vacuums listed on that library webpage with their full compatibilities? Especially I am interested in buying Xiaomi Mijia STYJ02YM (Viomi V2 Pro), Could someone confirm before purchase? Is there a possibility to use mop functionality nowadays with this Domoticz plugin?
Thanks.
RPI2 + RFLink + PiFace D2 + Aeon Z-Wave Gen5 + Foscams FI9821P&R2 + MySensors + UPS APC Back-UPS 950VA
RPI2 + RFXtrx433e + Foscams FI9821P + MySensors + UPS APC Back-UPS 950VA
RPIB+ + TP-Link MR3420 + Huawei E173 GarageDomoticz :)
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

after updating to Buster the plugin stopped working, the roborock control says off in the status, and if i restart the plugin i get this in the log:
2020-02-17 21:02:01.322 Status: (Roborock s50) Started.
2020-02-17 21:02:01.541 Status: (Roborock s50) Entering work loop.
2020-02-17 21:02:01.541 Status: (Roborock s50) Initialized version 0.1.3, author 'mrin'

nothing more, anyone else who has this problem?
Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by Geitje »

Yeah, had this too when upgrading to Buster. I needed some extra libs. I just walked through the installation process again, looked at the errors and advices the terminal gave, and got it fixed.
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

Thanks, did you have to ad the token again?
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

now i have installed the plugin again, but not everything works as it should, i can start the vaccum from domoticz, but i cant set the status of it, cant see battery or anything.

here is some of the log:
(.env) pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo ./test.py
test: python modules path: ././.env/lib/python3.7/site-packages
test: python modules path: ././.env/lib/python3.4/site-packages
test: trying connect to 127.0.0.1:22222
test: sent request to server [status]
test: reading response...
test: got server reply {'error': None, 'state_code': 8, 'battery': 100, 'fan_lev el': 38, 'clean_seconds': 3981, 'clean_area': 49.5025, 'cmd': 'status'}

what can be wrong?

i run Buster on rpi3
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

i also get this error in the domoticz log:

2020-02-18 17:15:58.866 Error: (xiaomi-mi-robot-vacuum) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/xiaomi-mirobot/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-02-18 17:15:58.866 Error: (Roborock s50) Module Import failed, exception: 'AttributeError'
2020-02-18 17:15:58.866 Error: (Roborock s50) Error Line details not available.
Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by Geitje »

Did you do

Code: Select all

sudo chmod +x miio_server.py
sudo chmod +x miio_server.sh
In the domoticz/plugins/xiaomi-mirobot dir?

It recieves data from server, but seems the plugin is not working well.
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

Yes i did sudo chmod , i have gone through the installation process several times, but it wont work, should i delete the old installation folder in domoticz /plugins before i install the plugin again? I havent done that before?
Jojik1
Posts: 16
Joined: Monday 06 January 2020 23:57
Target OS: -
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by Jojik1 »

tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

thank you all for your help, i had to delete the old installation folder and delete the plugin in plugin manager, then ad the plugin in the meny again and now it works.


thanks again :)
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

hmm, now i turned of the plugin in the plugin manager just to see if it starts again, but now i get error codes again:

2020-02-18 20:41:38.185 Error: (xiaomi-mi-robot-vacuum) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/xiaomi-mirobot/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-02-18 20:41:38.185 Error: (roborock) Module Import failed, exception: 'AttributeError'
2020-02-18 20:41:38.185 Error: (roborock) Error Line details not available.

for it to work again i need to remove the plugin and restart domoticz, then ad the plugin again for it to work.

what can be wrong?
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

and here is a log when the plugin works after a rebot of Domoticz:

2020-02-18 21:30:31.738 (roborock) Pushing 'ReadEvent' on to queue
2020-02-18 21:30:31.775 (roborock) Processing 'ReadEvent' message
2020-02-18 21:30:31.775 (roborock) Received 86 bytes of data
2020-02-18 21:30:31.775 (roborock) 87 a5 65 72 72 6f 72 c0 aa 73 74 61 74 65 5f 63 6f 64 65 08 ǥerror�state_code.
2020-02-18 21:30:31.775 (roborock) a7 62 61 74 74 65 72 79 64 a9 66 61 6e 5f 6c 65 76 65 6c 3c Ǣatterydɦan_level<
2020-02-18 21:30:31.775 (roborock) ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 04 aa 63 6c 65 61 ͣlean_seconds.ʣlea
2020-02-18 21:30:31.775 (roborock) 6e 5f 61 72 65 61 cb 00 00 00 00 00 00 00 00 a3 63 6d 64 a6 n_areaˮ.......ãmd�
2020-02-18 21:30:31.775 (roborock) 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. .. .. status
2020-02-18 21:30:31.775 (roborock) Pushing 'onMessageCallback' on to queue
2020-02-18 21:30:31.775 (roborock) Processing 'onMessageCallback' message
2020-02-18 21:30:31.775 (roborock) Calling message handler 'onMessage'.
2020-02-18 21:30:31.775 (roborock) Got: {'error': None, 'state_code': 8, 'battery': 100, 'fan_level': 60, 'clean_seconds': 4, 'clean_area': 0.0, 'cmd': 'status'}

there is an error code on the 4:th line from the top.
Jojik1
Posts: 16
Joined: Monday 06 January 2020 23:57
Target OS: -
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by Jojik1 »

2020-02-18 23:41:17.613 (robot) Pushing 'onHeartbeatCallback' on to queue
2020-02-18 23:41:17.614 (robot) Processing 'onHeartbeatCallback' message
2020-02-18 23:41:17.614 (robot) Calling message handler 'onHeartbeat'.
2020-02-18 23:41:17.614 (robot) Pushing 'WriteDirective' on to queue
2020-02-18 23:41:17.614 (robot) Processing 'WriteDirective' message
2020-02-18 23:41:17.614 (robot) Sending 8 bytes of data
2020-02-18 23:41:17.614 (robot) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. Ѧstatus
2020-02-18 23:41:17.672 (robot) Pushing 'ReadEvent' on to queue
2020-02-18 23:41:17.715 (robot) Processing 'ReadEvent' message
2020-02-18 23:41:17.715 (robot) Received 88 bytes of data
2020-02-18 23:41:17.715 (robot) 87 a5 65 72 72 6f 72 c0 aa 73 74 61 74 65 5f 63 6f 64 65 08 ǥerror�state_code.
2020-02-18 23:41:17.715 (robot) a7 62 61 74 74 65 72 79 64 a9 66 61 6e 5f 6c 65 76 65 6c 4b Ǣatterydɦan_levelK
2020-02-18 23:41:17.715 (robot) ad 63 6c 65 61 6e 5f 73 65 63 6f 6e 64 73 cd 01 2b aa 63 6c ͣlean_secondsͮ+ʣl
2020-02-18 23:41:17.715 (robot) 65 61 6e 5f 61 72 65 61 cb 40 1b 2e 14 7a e1 47 ae a3 63 6d ean_areaˀ...zᇮãm
2020-02-18 23:41:17.715 (robot) 64 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. dƳtatus
2020-02-18 23:41:17.715 (robot) Pushing 'onMessageCallback' on to queue
2020-02-18 23:41:17.715 (robot) Processing 'onMessageCallback' message
2020-02-18 23:41:17.715 (robot) Calling message handler 'onMessage'.
2020-02-18 23:41:17.715 (robot) Got: {'error': None, 'state_code': 8, 'battery': 100, 'fan_level': 75, 'clean_seconds': 299, 'clean_area': 6.795, 'cmd': 'status'}
avgays
Posts: 14
Joined: Monday 30 January 2017 12:02
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by avgays »

tjabas wrote: Tuesday 18 February 2020 20:44 for it to work again i need to remove the plugin and restart domoticz, then ad the plugin again for it to work.
Do you really need to REMOVE the plugin?

In my case this is "usual" way THIS plugin works -
any changes can be applied only by restarting Domotics after re-configuring/restarting plugin in the plugin manager (which always cause error)
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Xiaomi Mi Robot Vacuum

Post by tjabas »

Hi!

well youre right about that, i also noticed that i dont need to reinstall the plugin, i just need to reboot domoticz for it to work again, but i still get all these errors in the log:

2020-02-28 13:49:18.931 Error: roborock hardware (19) thread seems to have ended unexpectedly
2020-02-28 13:58:04.104 Error: roborock hardware (19) thread seems to have ended unexpectedly
2020-02-28 14:00:10.965 Error: roborock hardware (19) thread seems to have ended unexpectedly
2020-02-28 14:05:33.830 Error: roborock hardware (19) thread seems to have ended unexpectedly
2020-02-28 14:05:47.833 Error: roborock hardware (19) thread seems to have ended unexpectedly
2020-02-28 14:07:53.857 Error: roborock hardware (19) thread seems to have ended unexpectedly
2020-02-28 14:13:30.800 Error: roborock hardware (19) thread seems to have ended unexpectedly
2020-02-28 14:15:37.545 Error: roborock hardware (19) thread seems to have ended unexpectedly

but the vaccum seems to be connected anyway, is there a way to disable these error masseges?
it fill my log all the time.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest