Maybe some of you got one of those fancy vacuum robots while they where on sale? The Xiaomi Mi Robot is currently on sale for 257€ (gearbest.com) - I thought I share my setup to let the robot clean my home without using the chinese app at all.
First of all, I used mirobo to control the robot via wifi. I disabled internet access for the robot (via my router), so it can’t dial out to it’s chinese friends, but can still be managed remotely.
For me easy handling and auto shutdown was essential, so the charger won’t stay on 24/7. I use pimatic rules to control the robot. So whenever I leave the house and want it to be cleaned, I press a button before leaving, indicating for the robot to do it’s job while I am gone. It will wait for everyone to leave the house and start cleaning, charge again until the battery is full and then shutdown the charger, resulting in a clean home and no energy wasted.
-
Install mirobo https://github.com/rytilahti/python-mirobo and discover your robot. Note your IP and Token. Also block internet access to the robot once discovered.
-
Using a simple shell script to query the robot for status
#!/bin/bash
# Author georg90@github.com
trim() {
local var="$*"
# remove leading whitespace characters
var="${var#"${var%%[![:space:]]*}"}"
# remove trailing whitespace characters
var="${var%"${var##*[![:space:]]}"}"
echo -n "$var"
}
# Set robot ip
ROBOT = '192.168.0.130'
TOKEN = '12345678765432234'
ping -q -c2 $ROBOT > /dev/null
if [ $? -eq 0 ]
then
echo "Robot is online"
mapfile -t lines < <(sudo mirobo --ip $ROBOT --token $TOKEN status | cut -d ":" -f2)
# state
state=$(trim ${lines[0]})
#battery
battery=$(trim ${lines[1]})
#fanspeed
fanspeed=$(trim ${lines[2]})
#in cleaning
incleaning=$(trim ${lines[4]})
else
echo "Robot is offline"
state="Turned off"
battery="0"
fanspeed="none"
incleaning="none"
fi
echo $state
echo $battery
echo $fanspeed
echo $incleaning
# Update variable in pimatic (example)
curl -X PATCH --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'"$incleaning"'"}' --user "user:pass" http://$ROBOT:8080/api/variable-incleaning
- Using pimatic rules, you can control your robot even more
Frontend controls
Any ideas to improve the setup? What do you think?