Page 6 of 16
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Thursday 18 January 2018 16:02
by jorge
Did you place the plugin in the correct folder? If you did it should appear under hardware in Domoticz.
The folder should be; /home/pi/domoticz/plugins/.
https://www.domoticz.com/wiki/Using_Python_plugins
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Friday 19 January 2018 13:13
by domoticzag
I think this is the same issue as mentioned in this topic:
http://www.domoticz.com/forum/viewtopic ... 65&t=21379
Btw I have one question,
is this plugin working for Xiaomi Robot Gen 2?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Saturday 20 January 2018 16:24
by Quax1507
I just noticed that the utility sensors generated by the plugin are no longer updated with V3.8833.
I went back to V3.8825 and it is working again!
Ahy idea?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Sunday 21 January 2018 12:42
by DAVIZINHO
Quax1507 wrote: ↑Saturday 20 January 2018 16:24
I just noticed that the utility sensors generated by the plugin are no longer updated with V3.8833.
I went back to V3.8825 and it is working again!
Ahy idea?
same for me. but i dont back to older beta.
Its problem of the plugin? or the beta?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 22 January 2018 18:45
by RichardBokker
I hipe you guys can help me out.
I cannot finish the installation of this plugin.
i have problems with these 2, and cannot continu..
Code: Select all
sudo pip3 install -U setuptools
sudo pip3 install -U virtualenv
Its says:
i have tried everything regarding to get other packages installed (setuptools, of vritualenv), but is still not found..
i'm running Rpi2, started with default image.
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 22 January 2018 19:22
by Quax1507
Try: „apt-get install python3-pip“
or
apt-get install python3.5-pip“
Gesendet von iPhone mit Tapatalk
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 22 January 2018 19:39
by RichardBokker
Quax1507 wrote: ↑Monday 22 January 2018 19:22
Try: „apt-get install python3-pip“
or
apt-get install python3.5-pip“
I tried that also.
Python3-pip is installed.
Python3.5-pip says:
Code: Select all
E: Unable to locate package python3.5-pip
E: Couldn't find any package by regex 'python3.5-pip'
Yes i did a: "sudo apt-get update" first.
edit:
i'm required to install the miio to. That is also not working.
Does not work:
or
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 22 January 2018 19:47
by Quax1507
What's the output of:
"apt list --installed |fgrep -i python" ?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 22 January 2018 20:31
by RichardBokker
Quax1507 wrote: ↑Monday 22 January 2018 19:47
What's the output of:
"apt list --installed |fgrep -i python" ?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 22 January 2018 20:34
by Quax1507
Strange! No idea...
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 22 January 2018 20:36
by Quax1507
Hmmm?
Missing search path?
What about "/usr/bin/apt list --installed |fgrep -i python"
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Tuesday 23 January 2018 7:30
by RichardBokker
unfortunally, that is not working too.

Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Friday 26 January 2018 21:52
by mrinner
@RichardBokker
did you installed python3-pip with sudo? "sudo apt-get install python3-pip"
If yes, pip3 cmd should be available 100%

Then,
cd xiaomi-mirobot # plugin folder
virtualenv -p python3 .env # creating environment for python libs
source .env/bin/activate # activating environment, only after this step you need to install other relations:
pip3 install gevent msgpack-python python-miio==0.3.1
I'm on 3.8805 and all works. I'll try to update to the latest beta on dev machine next week.
Also seems dz have many issues with python subsytem on the latest beta...
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 29 January 2018 21:43
by DAVIZINHO
hello,
i want to make a dzvents that send me a notification for change main brush
i make this dzvents and not works
local cepillo = domoticz.devices('Vacuum - Care Main Brush')
if (cepillo.sensorType < 10) then
cepillo_var.set(1)
domoticz.notify('AVISO','VACUUM CHANGE MAIN BRUSH', '', domoticz.PRIORITY_LOW)
end
I thint the .sensorType is not the correct parameter. can someone tell me the correct?
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Friday 09 February 2018 16:57
by RichardBokker
mrinner wrote: ↑Friday 26 January 2018 21:52
@RichardBokker
did you installed python3-pip with sudo? "sudo apt-get install python3-pip"
If yes, pip3 cmd should be available 100%

Then,
cd xiaomi-mirobot # plugin folder
virtualenv -p python3 .env # creating environment for python libs
source .env/bin/activate # activating environment, only after this step you need to install other relations:
pip3 install gevent msgpack-python python-miio==0.3.1
I'm on 3.8805 and all works. I'll try to update to the latest beta on dev machine next week.
Also seems dz have many issues with python subsytem on the latest beta...
Sorry, i read this just now.
I think my installation was corrupt. I made a new installation on a new Pi, and everything works perfect now.
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Friday 09 February 2018 17:04
by RichardBokker
What command's do i use to control the robot?
I want to make script with LUA.
i think i should use:
Code: Select all
otherdevices['Robot - Control'] = "".
But what entries? Home , Cleaning or On are not working.
Anysone some ideas?
I did managed to readout the status with:
Code: Select all
if otherdevices['Robot - Status'] == "Cleaning" then
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Monday 12 February 2018 11:52
by RichardBokker
RichardBokker wrote: ↑Friday 09 February 2018 17:04
What command's do i use to control the robot?
I want to make script with LUA.
i think i should use:
Code: Select all
commandarray['Robot - Control'] = "".
But what entries? Home , Cleaning or On are not working.
Anysone some ideas?
I did managed to readout the status with:
Code: Select all
if otherdevices['Robot - Status'] == "Cleaning" then
Someone, please?
edit:
found, it is: commandArray['Robot - Control''] = 'Set Level 10' (or 20, 30, 40, 50, 60)
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Tuesday 13 February 2018 6:08
by arigato
RichardBokker wrote: ↑Monday 12 February 2018 11:52
RichardBokker wrote: ↑Friday 09 February 2018 17:04
What command's do i use to control the robot?
I want to make script with LUA.
i think i should use:
Code: Select all
commandarray['Robot - Control'] = "".
But what entries? Home , Cleaning or On are not working.
Anysone some ideas?
I did managed to readout the status with:
Code: Select all
if otherdevices['Robot - Status'] == "Cleaning" then
Someone, please?
edit:
found, it is: commandArray['Robot - Control''] = 'Set Level 10' (or 20, 30, 40, 50, 60)
The code you pasted for your IF statement seems to only check if its either On or OFF. But not if its Cleaning, Paused, Sleeping, In Error, Charging, Back to home, etc.
After your tip on controlling the robot, I think I might have found the fix to override the Xiaomi Mi Robot Main Brush Blocked fault error and have it continue cleaning.
Here's the Lua script:
Code: Select all
commandArray = {}
if otherdevices_svalues['Robot - Status'] == "In Error" then
print ("Resuming the Cleanup")
commandArray['Robot - Control'] = 'Set Level 10'
else
print(otherdevices_svalues['Robot - Status'])
end
return commandArray
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Wednesday 14 February 2018 10:37
by RichardBokker
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
Re: Python plugin: Xiaomi Mi Robot Vacuum
Posted: Saturday 24 February 2018 13:02
by Falken
EDIT:
I solved it!
The server had apparently crashed when I tried to start it erlier today, so when I ran my server tests now. It started for a moment to update the vaccums information.
When I tried to start the server the "right way" via: sudo service miio_server start and sudo chmod +x test.py, it all started working.
Puh!
(Original post below)
Hi!
I have installed the plugin, and got the hardware setup. But, my devices are all out of sync and does not really do anything.
Where should I begin my trouble shooting?
I have checked the robots ip and token-settings, they are correct.
EDIT:
I just noticed that the parameters of the switches updates when I run sudo ./miio_server.py 192.168.1.233 476e6b70343055483230644c53707a12 --host 127.0.0.1 --port 22222
The server, however starts on port 59238 and is giving correct data from the vaccum. The port it starts on seems do differ between the server starts.
What is causing this, and what should I do to remain a stable connection.
When the switches updates in the Domoticz interface, I am still unable to send any commands to the vaccum via the switches.
Thank you!