Page 10 of 16
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 27 August 2018 11:51
by DAVIZINHO
dlefol wrote: Monday 27 August 2018 11:40
As far as I know there is no sensor in the dustbin of the vacuum cleaner so it s not possible to get the information of how full the dustbin is.
i thing so.
the mihome app send notificacion with a "timer" no more

Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Tuesday 28 August 2018 17:51
by dagasoft
dlefol wrote: Monday 27 August 2018 11:40
As far as I know there is no sensor in the dustbin of the vacuum cleaner so it s not possible to get the information of how full the dustbin is.
So how does Mi Home notify about cleaning the dust bin?
I get notifications that say "you have to empty the dust bin".
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Tuesday 28 August 2018 20:50
by dagasoft
DAVIZINHO wrote: Monday 27 August 2018 11:51
dlefol wrote: Monday 27 August 2018 11:40
As far as I know there is no sensor in the dustbin of the vacuum cleaner so it s not possible to get the information of how full the dustbin is.
i thing so.
the mihome app send notificacion with a "timer" no more
Thank you for your reply. So I think I will implement notifications through a timer in domoticz to remember to clean the dust bin after some hours of use. I see in the python script that there is an option to get all time cleaned, do you know if we are able to read it from domoticz?
Thanks.
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Tuesday 02 October 2018 6:49
by scriptedbackdoor
How can it be used with iRoomba robocouum?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Thursday 18 October 2018 14:26
by wouterlet
Philos31 wrote: Monday 13 August 2018 12:23
Is there someone who has this plugin working in domoticz on Synology Nas?
I have tried but am missing to many things, maybe someone could help?
I'm looking for this also. I found the manuals but there is no "apt-get" available on my synology. It seemed Debian Chroot did this in the past, but isn't available anymore. Who knows a solution?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Thursday 08 November 2018 13:33
by misko903
I got closer with your posts, but I have ended here:
Code: Select all
(.env) pi@raspberrypi:~/domoticz/plugins/xiaomi-mi-robot-vacuum $ pip3 install -r pip_req.txt
after few installs come this message:
Code: Select all
...
Using cached https://files.pythonhosted.org/packages/6b/88/48dbe88b10098f98acef33218763c5630b0081c7fd0849ab4793b1e9b6d3/zeroconf-0.19.1-py2.py3-none-any.whl
Installing collected packages: android-backup, asn1crypto, attrs, pycparser, cffi, click, construct, six, idna, cryptography, enum-compat, greenlet, gevent, msgpack-python, netifaces, pretty-cron, pycrypto, pytz, typing, zeroconf, python-miio
Could not install packages due to an EnvironmentError: [Errno 13] PrÃstup odmietnutý: '/home/pi/domoticz/plugins/xiaomi-mi-robot-vacuum/.env/lib/python3.5/site-packages/android_backup-0.1.0.dist-info'
Consider using the `--user` option or check the permissions.
then i was trying
Code: Select all
pi@raspberrypi:~/domoticz/plugins/xiaomi-mi-robot-vacuum/.env/lib/python3.5/site-packages $ ls
and saw that the files your shell listed is much smaller than yours:
Code: Select all
easy_install.py pip-18.1.dist-info __pycache__ setuptools-40.5.0.dist-info wheel-0.32.2.dist-info
pip pkg_resources setuptools wheel
what i am doing wrong?
Thanks for replies!
Jheronymus wrote: Saturday 02 June 2018 15:09
Jheronymus wrote: Thursday 17 May 2018 16:56
Geitje 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)
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'
I've added this:
Code: Select all
sys.path.append('/usr/local/lib/python3.4/dist-packages')
FYI:
I get this response for searching for msgpack:
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
I've no idea how to debug this at this point. When I run the test script:
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 $
But if I start the server from the command line and run the test.py from another console, I can get valid output.
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)
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/msgpack
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
You might also upgrade setuptools in the virtualenv.
then just run the pip3 install -r pip_req.txt command
All should be fine. Close the virtualenv with
Now you can actualy see the packages in the virtualenv:
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
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Friday 09 November 2018 22:17
by misko903
update:
firing:
Code: Select all
pi@raspberrypi:~/domoticz/plugins/xiaomi-mi-robot-vacuum $ virtualenv -p python3 .env
caused:
Code: Select all
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/pi/domoticz/plugins/xiaomi-mi-robot-vacuum/.env/bin/python3
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/virtualenv.py", line 762, in main
symlink=options.symlink,
File "/usr/local/lib/python3.5/dist-packages/virtualenv.py", line 998, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "/usr/local/lib/python3.5/dist-packages/virtualenv.py", line 1318, in install_python
make_exe(py_executable)
File "/usr/local/lib/python3.5/dist-packages/virtualenv.py", line 449, in make_exe
os.chmod(fn, newmode)
PermissionError: [Errno 1] Operation not permitted: '/home/pi/domoticz/plugins/xiaomi-mi-robot-vacuum/.env/bin/python3'
tried to uninstall virtual env with
and installed it back
but result is the same.
should I and if yes, how I can uninstall pip3 from usr/bin?
EDIT:
i have made something:
Code: Select all
> sudo which pip3
/usr/local/bin/pip3
nothing else is changed, still the same virtualenv errors.
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Saturday 10 November 2018 23:02
by misko903
installed it new from scratch.
everything works, except:
Code: Select all
pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo ./test.py
test: python modules path: ././.env/lib/python3.5/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.5/socket.py", line 712, in create_connection
raise err
File "/usr/lib/python3.5/socket.py", line 703, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
after that,
Code: Select all
pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo service miio_server stop
pi@raspberrypi:~/domoticz/plugins/xiaomi-mirobot $ sudo ./miio_server.py IP token --host 127.0.0.1 --port 22222
Traceback (most recent call last):
File "./miio_server.py", line 18, in <module>
from miio import Vacuum, DeviceException
File "/usr/local/lib/python3.5/dist-packages/miio/__init__.py", line 2, in <module>
from miio.airconditioningcompanion import AirConditioningCompanion
File "/usr/local/lib/python3.5/dist-packages/miio/airconditioningcompanion.py", line 8, in <module>
from .device import Device, DeviceException
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 16, in <module>
from .protocol import Message
File "/usr/local/lib/python3.5/dist-packages/miio/protocol.py", line 190, in <module>
Const(0x2131, Int16ub),
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 1930, in __init__
super(Const, self).__init__(subcon)
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 288, in __init__
raise TypeError("subcon should be a Construct field")
TypeError: subcon should be a Construct field
and there I have ended.
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 19 November 2018 10:37
by Stimpy68
Can't seem to find it anywhere, how do you update the miirobo part?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Thursday 29 November 2018 21:44
by misko903
Stimpy68 wrote:Can't seem to find it anywhere, how do you update the miirobo part?
I am just testing by the sequence given in the manual...
What should I try to do?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Sunday 02 December 2018 14:04
by Stimpy68
misko903 wrote: Thursday 29 November 2018 21:44
Stimpy68 wrote:Can't seem to find it anywhere, how do you update the miirobo part?
I am just testing by the sequence given in the manual...
What should I try to do?
I already found it, just execute
It updates the python miio part if you already installed it earlier. I was missing a few commands in the older version.
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Friday 28 December 2018 21:03
by droop
Hello,
I have installed the plugin with the last stable version of Domoticz on a Rpi3.
test.py works well and i can add the hardware in domoticz interface.
The logs shows that domoticz can communicate with the server.
My problem is that no new devices are available into domoticz.
does someone have any idea ?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Friday 28 December 2018 23:40
by dagasoft
droop wrote:Hello,
I have installed the plugin with the last stable version of Domoticz on a Rpi3.
test.py works well and i can add the hardware in domoticz interface.
The logs shows that domoticz can communicate with the server.
My problem is that no new devices are available into domoticz.
does someone have any idea ?
Same case here. I've updated to latest stable version and I can't see any device, even if I remove and add hardware again.
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Saturday 29 December 2018 8:28
by droop
I have solved my problem by activating "Accept new Hardware Devices" in Domoticz "Settings" before creating the Hardware.
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Saturday 29 December 2018 9:51
by dagasoft
droop wrote:I have solved my problem by activating "Accept new Hardware Devices" in Domoticz "Settings" before creating the Hardware.
Thanks for the suggestion droop!
Now devices appear correctly.
By the way, after the upgrade I also have a problem when I add device control, it shows a string of numbers and letters over its name instead of the device name.
Do you know what the problem could be?
I tried doing a apt-get upgrade and then a reboot but it didn't help.

Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Saturday 05 January 2019 17:32
by axel2906
Stimpy68 wrote: Saturday 11 August 2018 13:22
Is there anyway to use the "spot" function? There is a button in Domoticz, but when I push it, the vacuum says that I have to place the vacuum in the target area. Usually you draw the target area in the map with the app and start the zoned cleanup.
The protocol had the command for it:
https://github.com/marcelrv/XiaomiRobot ... d_clean.md
Would be nice to incorperate that in the plugin, also the "mop" option would be nice to have.
Did you find a way to do this ? i know that Home Assistant can do it. I try it and it works so it must be possible to do the same in domoticz. I hope so
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Wednesday 09 January 2019 20:26
by Fiury
wouterlet wrote: Thursday 18 October 2018 14:26
Philos31 wrote: Monday 13 August 2018 12:23
Is there someone who has this plugin working in domoticz on Synology Nas?
I have tried but am missing to many things, maybe someone could help?
I'm looking for this also. I found the manuals but there is no "apt-get" available on my synology. It seemed Debian Chroot did this in the past, but isn't available anymore. Who knows a solution?
Im also "fighting" on Synology , but im also loosing..
Still nobody on Synology NAS ?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Sunday 13 January 2019 12:31
by axel2906
axel2906 wrote: Saturday 05 January 2019 17:32
Stimpy68 wrote: Saturday 11 August 2018 13:22
Is there anyway to use the "spot" function? There is a button in Domoticz, but when I push it, the vacuum says that I have to place the vacuum in the target area. Usually you draw the target area in the map with the app and start the zoned cleanup.
The protocol had the command for it:
https://github.com/marcelrv/XiaomiRobot ... d_clean.md
Would be nice to incorperate that in the plugin, also the "mop" option would be nice to have.
Did you find a way to do this ? i know that Home Assistant can do it. I try it and it works so it must be possible to do the same in domoticz. I hope so
I find a way to get it working so now i can choose wich room would be cleaned

- Capture4.PNG (13.75 KiB) Viewed 4242 times
you need
python 3.5 or above (i've followed this
https://gist.github.com/dschep/24aa6167 ... 824400d37f)
set python 3.x as default (update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2)
sudo apt-get install python3-pip
pip3 install python-miio
try in command line : sudo -H -u pi mirobo --ip MYIP --token MYTOKEN status
create sh script in /home/pi/domoticz/scripts (sudo -H -u pi mirobo --ip MYIP --token MYTOKEN zoned-clean [[26044,17953,30944,21153,1]]
chmod +x sh file
then make in domoticz a dummy selector switch, set your room adn set for each room the link to each script

- Capture5.PNG (62.42 KiB) Viewed 4242 times
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Sunday 13 January 2019 13:13
by dagasoft
axel2906 wrote:axel2906 wrote: Saturday 05 January 2019 17:32
Stimpy68 wrote: Saturday 11 August 2018 13:22
Is there anyway to use the "spot" function? There is a button in Domoticz, but when I push it, the vacuum says that I have to place the vacuum in the target area. Usually you draw the target area in the map with the app and start the zoned cleanup.
The protocol had the command for it:
https://github.com/marcelrv/XiaomiRobot ... d_clean.md
Would be nice to incorperate that in the plugin, also the "mop" option would be nice to have.
Did you find a way to do this ? i know that Home Assistant can do it. I try it and it works so it must be possible to do the same in domoticz. I hope so
I find a way to get it working so now i can choose wich room would be cleaned
Capture4.PNG
you need
python 3.5 or above (i've followed this
https://gist.github.com/dschep/24aa6167 ... 824400d37f)
set python 3.x as default (update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2)
sudo apt-get install python3-pip
pip3 install python-miio
try in command line : sudo -H -u pi mirobo --ip MYIP --token MYTOKEN status
create sh script in /home/pi/domoticz/scripts (sudo -H -u pi mirobo --ip MYIP --token MYTOKEN zoned-clean [[26044,17953,30944,21153,1]]
chmod +x sh file
then make in domoticz a dummy selector switch, set your room adn set for each room the link to each script
Capture5.PNG
That's a great implementation to do zoned clean in domoticz.
By the way, how do you determine limits to input the numbers in each room?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Sunday 13 January 2019 13:53
by axel2906
dagasoft wrote: Sunday 13 January 2019 13:13
axel2906 wrote:axel2906 wrote: Saturday 05 January 2019 17:32
Did you find a way to do this ? i know that Home Assistant can do it. I try it and it works so it must be possible to do the same in domoticz. I hope so
I find a way to get it working so now i can choose wich room would be cleaned
Capture4.PNG
you need
python 3.5 or above (i've followed this
https://gist.github.com/dschep/24aa6167 ... 824400d37f)
set python 3.x as default (update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2)
sudo apt-get install python3-pip
pip3 install python-miio
try in command line : sudo -H -u pi mirobo --ip MYIP --token MYTOKEN status
create sh script in /home/pi/domoticz/scripts (sudo -H -u pi mirobo --ip MYIP --token MYTOKEN zoned-clean [[26044,17953,30944,21153,1]]
chmod +x sh file
then make in domoticz a dummy selector switch, set your room adn set for each room the link to each script
Capture5.PNG
That's a great implementation to do zoned clean in domoticz.
By the way, how do you determine limits to input the numbers in each room?
i make sh file for each room. I take the coordinates from FloleVac (android app). this app do the same as the offical app but when you do clean zone, select the zone that you clean and then long press on cleanup he make a copy of the coordinates into the clipboard. I do it for each room.