Python plugin: Xiaomi Mi Robot Vacuum Topic is solved
Moderator: leecollings
- gijsje
- Posts: 132
- Joined: Saturday 19 August 2017 14:28
- Target OS: NAS (Synology & others)
- Domoticz version: Stable
- Location: Berkel Enschot, NL
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
I do have the problem the vacuum gets stuck under the couch.
There is this magnetic tape to prevent the vacuum to go over it when you put it on the floor.
Does anyone know if it would also work if you stick it underneath the couch?
There is this magnetic tape to prevent the vacuum to go over it when you put it on the floor.
Does anyone know if it would also work if you stick it underneath the couch?
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
-
- 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
Hmm.. it should be on the forum somewhere. Is you search with time between. Cannot answer now with code, on vacationmolnaratti wrote: ↑Friday 11 May 2018 22:01Very good, thanks. You would share the time between.lua script?RichardBokker wrote: ↑Wednesday 14 February 2018 10:37 I got the script working, but had to convert the Robot - state with tostring().
Here is my case-construction that i'm using.
Code: Select all
-- Using TimeBetween script in main LUA script folder package.path = package.path .. ';' .. '/home/pi/domoticz/scripts/lua/script_time_TimeBetween.lua' local TimeBetween = require('timebetween') time = os.date("*t") commandArray = {} -- Possible state's of Robot Vacuum: Charging / Paused / Cleaning / Waiting / Back to home / Sleeping -- Selector witch Robot Vacuum: Clean(10) / Home(20) / Spot(30) / Pauze(40) / Stop(50) / Find(60) ---- Variabele to use -- StoffieState (uservariable) -- AtHome (uservariable) -- Stoffie - Control (device) -- Stoffie - Status (device) local stoffie = 'Stoffie - Status' -- print(otherdevices_svalues[stoffie] .. " dit is de actuele status") -- Required to convert State to Stringvalue StoffieStatus = tostring(otherdevices_svalues[stoffie]); -- IDLE if (uservariables['StoffieState'] == 'IDLE') then print ("Stoffie is idle"); if timebetween("08:00","16:00") then -- Run's only during day hours. if (uservariables['AtHome'] == 'NO') then -- Run's only when nobody is at home commandArray['SendNotification']='Stoffie is Starting' commandArray['Variable:StoffieState']='STARTING' -- Start Robot command, command send once. commandArray['Stoffie - Control'] = 'Set Level 10' end end end -- STARTING if (uservariables['StoffieState'] == 'STARTING') then if StoffieStatus == 'Cleaning' then -- If robot is cleaning, continu to next step commandArray['SendNotification']='Stoffie is Running' commandArray['Variable:StoffieState']='RUNNING' end if timebetween("16:00","08:00") then -- is program hangs, to executed state commandArray['Variable:StoffieState']='EXECUTED' end end -- RUNNING if (uservariables['StoffieState'] == 'RUNNING') then if StoffieStatus == 'Back to home' then -- If robot is going back to home, continu to next step commandArray['SendNotification']='Stoffie is Stopping' commandArray['Variable:StoffieState']='STOPPING' end end -- STOPPING if (uservariables['StoffieState'] == 'STOPPING') then if StoffieStatus == 'Charging' then -- if robot is Charging, continu to next step commandArray['SendNotification']='Stoffie is Executed' commandArray['Variable:StoffieState']='EXECUTED' -- Stop Robot command, command send once. commandArray['Stoffie - Control'] = 'Set Level 50' end end -- EXECUTED if (uservariables['StoffieState'] == 'EXECUTED') then if timebetween("23:55","23:56") then -- Runs only once a day. Reset at end of day. commandArray['SendNotification']='Stoffie going to Idle' commandArray['Variable:StoffieState']='IDLE' end end return commandArray
-
- Posts: 170
- Joined: Monday 22 January 2018 21:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
Dont know, just try it I would say...
gijsje wrote: ↑Monday 21 May 2018 19:33 I do have the problem the vacuum gets stuck under the couch.
There is this magnetic tape to prevent the vacuum to go over it when you put it on the floor.
Does anyone know if it would also work if you stick it underneath the couch?
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
Zwave, Zigate, RFlink etc.
-
- Posts: 42
- Joined: Wednesday 01 April 2015 11:52
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
I use the magnetic tape to stop the Xiaomi Mi Robot from getting stuck on the coffee table, and can confirm this works good. The Xiaomi Mi Robot slightly crosses the tape, and then returns.gijsje wrote: ↑Monday 21 May 2018 19:33 I do have the problem the vacuum gets stuck under the couch.
There is this magnetic tape to prevent the vacuum to go over it when you put it on the floor.
Does anyone know if it would also work if you stick it underneath the couch?
- gijsje
- Posts: 132
- Joined: Saturday 19 August 2017 14:28
- Target OS: NAS (Synology & others)
- Domoticz version: Stable
- Location: Berkel Enschot, NL
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
Thanks for that i will order some
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
-
- Posts: 11
- Joined: Thursday 17 May 2018 16:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
So, I fixed my earlier problem. I noticed I was using sudo a lot. And you have to be carefull with that while in the virtualenv. As you can see in the logs posted before, the msgpack was installed, but outside the virtual env. /usr/local/lib/python3.4/dist-packages/msgpackJheronymus wrote: ↑Thursday 17 May 2018 16:56Geitje wrote: ↑Tuesday 06 March 2018 1:29 I already found out.
See this post: http://www.domoticz.com/forum/viewtopic ... ck#p163889.
Note: insert:
sys.path.append('/usr/local/lib/python3.5/site-packages')
after "import domoticz" in the plugin.py file.
so WITHOUT the and /b codes mentioned in the post, if you insert them too it does nog work I found out!
Hi, I have a similar problem, but the solution didn't work for me.
When I try to add the line, domoticz won't boot (ie. the browser keeps indicating domoticz is offline or not available)
The error in the domoticz log (without the line)I've added this:Code: Select all
Error: (xiaomi-mi-robot-vacuum) failed to load 'plugin.py', Python Path used was '/home/jeroen/domoticz/plugins/xiaomi-robot/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'. Error: (Robottest) Module Import failed, exception: 'ImportError' Error: (Robottest) Module Import failed: ' Name: msgpack'
FYI:Code: Select all
sys.path.append('/usr/local/lib/python3.4/dist-packages')
I get this response for searching for msgpack:
I've no idea how to debug this at this point. When I run the test script:Code: Select all
jeroen@Domoticz:~ $ sudo find / -name msgpack* [sudo] password for jeroen: /home/jeroen/domoticz/plugins/xiaomi-robot/.env/lib/python3.4/site-packages/pip/_vendor/msgpack /home/jeroen/.cache/pip/wheels/62/f3/0d/f77f20fce259496b053d6c0dc0eea7114527cf0a7da115a980/msgpack_python-0.4.8-cp34-cp34m-linux_armv6l.whl /usr/local/lib/python3.4/dist-packages/msgpack_python-0.4.8-py3.4.egg-info /usr/local/lib/python3.4/dist-packages/msgpack
But if I start the server from the command line and run the test.py from another console, I can get valid output.jeroen@Domoticz:~/domoticz/plugins/xiaomi-robot $ sudo ./test.py
test: python modules path: ././.env/lib/python3.4/site-packages
test: trying connect to 127.0.0.1:22222
Traceback (most recent call last):
File "./test.py", line 22, in <module>
client = socket.create_connection((args.host, args.port))
File "/usr/lib/python3.4/socket.py", line 509, in create_connection
raise err
File "/usr/lib/python3.4/socket.py", line 500, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
jeroen@Domoticz:~/domoticz/plugins/xiaomi-robot $sudo python3 miio_server.py 192.168.1.43 token
server: Starting server on 127.0.0.1 22222
server: connected ('127.0.0.1', 42656)
server: got socket msg: ['status']
server: vac result {'clean_area': 62.4725, 'error': None, 'battery': 100, 'cmd': 'status', 'state_code': 8, 'clean_seconds': 4418, 'fan_level': 60}
server: send reply ('127.0.0.1', 42656)
server: closed connection ('127.0.0.1', 42656)
You can test it like this:
Code: Select all
> which python
/usr/bin/python
> which pip3
/usr/bin/pip3
>source .env/bin/activate
>which python3
/home/jeroen/domoticz/plugins/xiaomi-mirobot/.env/bin/python3
>which pip3
/home/jeroen/domoticz/plugins/xiaomi-mirobot/.env/bin/pip3
>sudo which pip3
/usr/bin/pip3 <= sudo points outside the virtualenv
then just run the pip3 install -r pip_req.txt command
All should be fine. Close the virtualenv with
Code: Select all
>deactivate
Code: Select all
>~/domoticz/plugins/xiaomi-mirobot/.env/lib/python3.5/site-packages $ ls
Crypto msgpack
__pycache__ msgpack_python-0.4.8.dist-info
_cffi_backend.cpython-35m-arm-linux-gnueabihf.so netifaces-0.10.6.dist-info
android_backup netifaces.cpython-35m-arm-linux-gnueabihf.so
android_backup-0.1.0.dist-info pip
asn1crypto pip-10.0.1.dist-info
asn1crypto-0.23.0.dist-info pkg_resources
attr pretty_cron
attrs-17.2.0.dist-info pretty_cron-1.0.2.dist-info
cffi psutil
cffi-1.11.2.dist-info psutil-5.4.5.dist-info
click pycparser
click-6.7.dist-info pycparser-2.18.dist-info
construct pycrypto-2.6.1.dist-info
construct-2.8.16.dist-info python_miio-0.3.1.dist-info
cryptography pytz
cryptography-2.1.3.dist-info pytz-2017.3.dist-info
easy_install.py setuptools
enum_compat-0.0.2.dist-info setuptools-39.2.0.dist-info
gevent six-1.11.0.dist-info
gevent-1.2.2.dist-info six.py
greenlet-0.4.12.dist-info typing-3.6.2.dist-info
greenlet.cpython-35m-arm-linux-gnueabihf.so typing.py
idna wheel
idna-2.6.dist-info wheel-0.31.1.dist-info
miio zeroconf-0.19.1.dist-info
mirobo zeroconf.py
-
- Posts: 11
- Joined: Thursday 17 May 2018 16:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
So now I've added the plugin and it is running. NO errors in the log.
I can add the Xiaomi Mi Robot Vacuum hardware (name: PoetsBot, fan level: slider, debug: true)
I can see the devices, but when I add them, the 'control ones' don't appear.
How do I have to set these up?
Under utility I can see:
Under switches I only see
How do I set this up that I can have the controls for the mode and the fan level?
I can add the Xiaomi Mi Robot Vacuum hardware (name: PoetsBot, fan level: slider, debug: true)
I can see the devices, but when I add them, the 'control ones' don't appear.
How do I have to set these up?
Under utility I can see:
- Battery
- Care Main Brush
- Care Side Brush
- Care Sensors
- Care Filter
Under switches I only see
- Status
How do I set this up that I can have the controls for the mode and the fan level?
-
- Posts: 53
- Joined: Saturday 24 September 2016 18:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
Roborock S50 is ok if it's the questioncorederoma82 wrote: ↑Wednesday 16 May 2018 11:16corederoma82 wrote: ↑Friday 11 May 2018 9:39 Hi,
can you say me how are the compatible vacuum cleaner model?
Thanks
Somebody can answer me?
Thanks
And S50 as a "MOP" mode but it's not available with the plugin. I'm trying to get the command line for MOP but can't find it.
-
- Posts: 53
- Joined: Saturday 24 September 2016 18:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
oups.... a new question while speaking about this fantastic plugin. What is the way to add a second robot ?
Regards
Eric
Regards
Eric
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
i may be a complete idiot but i can not seem to get the token of my little friend in any possible way, i tried almost every guide i could find on the interwebz but no luck for me unfortunately. maby someone overhere can help me as i read some of you have had success so a little help is welcome...
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 11
- Joined: Thursday 17 May 2018 16:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
Hi SnelleJelleP,snellejellep wrote: ↑Monday 04 June 2018 11:35 i may be a complete idiot but i can not seem to get the token of my little friend in any possible way, i tried almost every guide i could find on the interwebz but no luck for me unfortunately. maby someone overhere can help me as i read some of you have had success so a little help is welcome...
I've experienced some challenges for getting my token. I've retraced my steps as far as possible. Let us know at what point you get stuck.
I performmed everything on my personal Android phone (Sony Z3 compact, non rooted) and a Windows 10 64bit laptop.
I did tried it first at my workphone (Samsung S7) but failed because company policies forced encrypted backups.
1) I started clicking at the link https://github.com/mrin/domoticz-mirobo ... vice-token
and ended up here
2) https://github.com/jghaanstra/com.xiaom ... oid-phones
After a try I couldn't find the token in the database I got. So I ended up installing an old version that I got from apkmirror.
https://apkdot.com/apk/xiaomi-inc/mihome/mihome-5-0-0/
(do this at your own risk, I thought I got it here, not sure. The file I used is called: com.xiaomi.smarthome-5.0.0-60690_minAPI14(armeabi-v7a)(nodpi)_apkmirror.com.apk)
Installed it, don't upgrade. Get your robot back in there.
3) Use adb tool to make the backup
In powershell something like:
>.\adb backup -noapk com.xiaomi.smarthome -f backupsony.ab
Your phone should be usb connected and in developer mode. The erros for adb are quite usefull, so read carefully them if you fail here.
4) install the adbextractor (see article for link)
(at this point you also need your java paths to be correct, which I didn't, so here's a rather weird command)
>'C:\Program Files\Java\jdk1.8.0_161\bin\java.exe' -jar ../android-backup-extractor/abe.jar unpack backupsony.ab backupsony.tar
5) unzip the tar with 7-zip
6) install sqlitebrowser (I used the portable one)
Open the miio2.db and query the database.
I just did select * from devicrecord, it only had one record and the column token is in there somewhere (at the end in my case)
Let us know where you get stuck.
Hope that helps.
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
@jheronymus, thankyou for your explanation, i got a token this time, only i think i did something wrong because my robot does not seem to react and i do not get any error messages. so i am kinda stuck because i can not give you any kind of information to help me troubleshoot
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
i do get weird messages in the log and it does not work unfortunately, the log:
- Spoiler: show
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 11
- Joined: Thursday 17 May 2018 16:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
@snellejellep What happens when you run step 4 and 5 of the installation for the plugin(the tests) on: https://github.com/mrin/domoticz-mirobo ... stallation
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
while i do not see step 5 you mentioned, i did step 4 the test .py and got this:Jheronymus wrote: ↑Tuesday 12 June 2018 9:51 @snellejellep What happens when you run step 4 and 5 of the installation for the plugin(the tests) on: https://github.com/mrin/domoticz-mirobo ... stallation
which can not be good i think
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 230
- Joined: Sunday 14 July 2013 20:21
- Target OS: Linux
- Domoticz version: 4.10233
- Location: Alkmaar, The Netherlands
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
I've got my roborock s50 yesterday(10 days after ordering) in the Netherlands.
I will try to connect it to domoticz this evening.
Fo Who is interested in also buying this xiaomi here is the sellers link https://nl.aliexpress.com/item/Xiaomi-m ... 4c4dEHGO0Z
I will try to connect it to domoticz this evening.
Fo Who is interested in also buying this xiaomi here is the sellers link https://nl.aliexpress.com/item/Xiaomi-m ... 4c4dEHGO0Z
-
- Posts: 11
- Joined: Thursday 17 May 2018 16:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
Sorry about that, with step 5 I meand the second test case, starting it manually:snellejellep wrote: ↑Wednesday 13 June 2018 19:41while i do not see step 5 you mentioned, i did step 4 the test .py and got this:Jheronymus wrote: ↑Tuesday 12 June 2018 9:51 @snellejellep What happens when you run step 4 and 5 of the installation for the plugin(the tests) on: https://github.com/mrin/domoticz-mirobo ... stallation
which can not be good i think
Code: Select all
sudo ./miio_server.py 192.168.1.12 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222
# then you can run test
sudo ./test.py
Code: Select all
sudo service miio_server stop
Code: Select all
sudo ./miio_server.py 192.168.1.12 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222
and the other one running the test script
Code: Select all
sudo ./test.py
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
Wow thanks, now it works when i use the command:Jheronymus wrote: ↑Thursday 14 June 2018 23:47 Sorry about that, with step 5 I meand the second test case, starting it manually:The error you're getting is that probably the server is not running. For this to work you need two terminals. One running the server:Code: Select all
sudo ./miio_server.py 192.168.1.12 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222 # then you can run test sudo ./test.py
Just to be sure nothing is runningCode: Select all
sudo service miio_server stop
This will start a new server (provide correct IP and hahs ofcourse) keep an eye on the console, since it will produce logging!Code: Select all
sudo ./miio_server.py 192.168.1.12 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222
and the other one running the test scriptBoth will produce logging information. That is relevant for us.Code: Select all
sudo ./test.py
Code: Select all
sudo ./miio_server.py 192.168.1.12 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222
i tried following all the steps but i can not seem to get the process miio_server.sh running
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
well i fixed it, i do not think it is the way i am supposed to do it but i added your command:
to the /etc/rc.local and that works really well, it only floods my domoticz log, but maby that is normal?Jheronymus wrote: ↑Thursday 14 June 2018 23:47Code: Select all
sudo ./miio_server.py 192.168.1.12 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 11
- Joined: Thursday 17 May 2018 16:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Xiaomi Mi Robot Vacuum
Not entirely sure if this correct though. The logging you can probably disable in the hardware setting (debug true/false).snellejellep wrote: ↑Friday 15 June 2018 21:05 well i fixed it, i do not think it is the way i am supposed to do it but i added your command:to the /etc/rc.local and that works really well, it only floods my domoticz log, but maby that is normal?Jheronymus wrote: ↑Thursday 14 June 2018 23:47Code: Select all
sudo ./miio_server.py 192.168.1.12 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222
I had some trouble installing this also. Note that it only works with the last stable version V3.8153 of domoticz.
Also, you need to check your installation in the virtual environment you've setup.
At first I did everything as 'root' (sudo all the commands), also in the virtual environment. Somehow that let to that pip3 installed everything in the normal python folders. (not in the virtualenv.) You can check this by reviewing the logging and paths in the ouput of the pip3 step, or use compare results for:
Code: Select all
>which python
>which pip3
Who is online
Users browsing this forum: No registered users and 1 guest