i managed to control my Xiaomi Mi Robot Vacuum with Domoticz, without catching UDP-packages or something like this. Lets look at it:
Steps:
1. Get the token of your mi robot with the MiToolkit :
https://github.com/ultrara1n/MiToolkit/releases
Sorry, its a german page, but Google-Translator is your friend . Your phone has to be in devmode and usb-debugging is activated. Connect your phone via usb to your pc.
2. Install "mirobo" (https://github.com/rytilahti/python-mirobo) on your domoticz-server. i´ve used this tutorial to manage this: http://blog.gurskiy.com/?p=62
This is a russian page, but with google translator, its is easy to handle.
After installing it, you should be able to control your robot with:
"sudo mirobo --ip [yourrobotiphere] --token [yourrobottokenhere] start"
3. Create a virtual switch in domoticz (On/Off).
4. Check the state with a device-based luascript and trigger "mirobo"-application like this:
Code: Select all
commandArray = {}
for deviceName,deviceValue in pairs(devicechanged) do
print ("Device based event fired on '"..deviceName.."', value '"..tostring(deviceValue).."'");
if (deviceName=='[nameofyourvirtualswitch]' ) then
if tostring(deviceValue) == "On" then
os.execute("sudo mirobo --ip [yourrobotiphere] --token [yourrobottokenhere] start")
elseif tostring(deviceValue) == "Off" then
os.execute("sudo mirobo --ip [yourrobotiphere] --token [yourrobottokenhere] home")
end
end
end
return commandArray
With controlicz i´m now able to call "Alexa, turn the vacuum on!", and my Xiamo Mi Robot will start going to work .
Just notice, that this is only an basic configuration. "Mirobo" is much more powerfull, like read the state of the xiaomi, manage dnd-mode, setting fanspeed and so on...
edit: i´ve added a icon for the xiaomi