-
Notifications
You must be signed in to change notification settings - Fork 255
Cloud Free Firmware Image With Valetudo
The Build and Installation Guide was moved to the Valetudo Wiki
https://github.com/Hypfer/Valetudo/wiki/Installation-Instructions
Old installation guide, may not work anymore, kept for historical purposes
- Gen1: v11_003468
- Gen2: v11_001768
You will want to use a Linux based system. It doesn't matter if it is your base OS on your PC/Laptop, a VM on your PC, a Server or any other device like a Raspi. Chose the Distro you like (I'm more the Debian guy). Make sure it has access to your LAN/Internet. It does NOT NEED WIFI!
WSL (Windows Subsystem for Linux) is not supported since it can't mount ext4 partitions for the time being.
You should make sure that the following packages are installed in your system:
- bash
- openssh (for ssh-keygen)
- ccrypt
- sed
- dos2unix
- git
- python3-venv
You need to have a public / private ssh-key pair to connect to the robot. If you do not have a keypair yet, you can generate one with the following command
ssh-keygen -t ed25519 -C "your_email@example.com"
Per default, the generated keys will be created under ~/.ssh
.
If you choose to create the keys in another location, remember your chosen location for later.
-
Create a new directory for your work
mkdir rockrobo cd rockrobo
-
Clone the dustcloud repository (until imagebuilder > 0.1 is available)
git clone https://github.com/dgiese/dustcloud.git
-
Create a valetudo directory
mkdir valetudo pushd valetudo
-
Download the latest valetudo binary from https://github.com/Hypfer/Valetudo/releases
wget https://github ... mkdir deployment pushd deployment wget https://github.com/Hypfer/Valetudo/raw/master/deployment/valetudo.conf wget https://github.com/Hypfer/Valetudo/raw/master/deployment/etc/hosts wget https://github.com/Hypfer/Valetudo/raw/master/deployment/etc/rc.local popd popd
-
Create rrlogd-patcher directory
mkdir rrlogd-patcher pushd rrlogd-patcher
-
Download the latest
patcher.py
wget https://raw.githubusercontent.com/JohnRev/rrlogd-patcher/master/patcher.py popd
-
Create firmware directory
mkdir firmware pushd firmware
-
Download the latest firmware (e.g. v001792)
wget URL
URL:
Gen1
https://cdn.awsbj0.fds.api.mi-img.com/updpkg/[package name] https://cdn.awsde0.fds.api.mi-img.com/updpkg/[package name] Example: https://cdn.awsbj0.fds.api.mi-img.com/updpkg/v11_003468.fullos.pkg
Gen2
https://cdn.awsbj0.fds.api.mi-img.com/rubys/updpkg/[package name] https://cdn.cnbj2.fds.api.mi-img.com/rubys/updpkg/[package name] https://cdn.cnbj0.fds.api.mi-img.com/rubys/updpkg/[package name] https://cdn.awsde0.fds.api.mi-img.com/rubys/updpkg/[package name] Example: https://cdn.cnbj2.fds.api.mi-img.com/rubys/updpkg/v11_001748.fullos.pkg
If you followed the above commands, your rockrobo
directory structure should now look like this:
tree -L 2 rockrobo/
rockrobo/
├── dustcloud
│ ├── cloudprotocol.pdf
│ ├── devices
│ ├── docker
│ ├── dummycloud
│ ├── dustcloud
│ ├── LICENSE
│ ├── Pipfile
│ ├── Pipfile.lock
│ ├── presentations
│ └── README.md
├── firmware
│ └── v11_001712.pkg
├── rrlogd-patcher
│ └── patcher.py
└── valetudo
├── deployment
└── valetudo
Next, we can create the firmware image.
To create the firmware image you should run the following commands:
mkdir image
cd image
sudo ../dustcloud/devices/xiaomi.vacuum/firmwarebuilder/imagebuilder.sh \
--firmware=../firmware/v11_001712.pkg \
--soundfile=../firmware/english.pkg \
--public-key=$HOME/.ssh/id_ed25519.pub \
--valetudo-path=../valetudo \
--disable-firmware-updates \
--ntpserver=fritz.box \
--rrlogd-patcher=../rrlogd-patcher/patcher.py \
--replace-adbd
Here you need now to remember the location of your generated public ssh-key, id_ed25519.pub
. If you don't have a public key yet, take a look at the Prerequisites section.
Note that not all options are required. However if your router runs a ntp server you should use it. Also I would recommend to replace adbd so in case something goes really wrong you can still access it via USB.
Make sure that rrlogd gets patched, (see Appendix for supported versions). You should see something like:
Creating backup of rrlogd
Trying to patch rrlogd
Successfully patched rrlogd
WARNING: If you patch rrlogd you should use dummycloud or your data will be sent unencrypted to Xiaomi servers!
After the successful build of the firmware image, we can tell the robot to download and flash it. First, we need to create a virtual environment for it in python. For this the following packages need to be installed:
- python3
- python3-pip
- python3-venv
cd ..
mkdir flasher
cd flasher
python3 -m venv venv
and install the required miio python packages:
source venv/bin/activate
pip3 install wheel
pip3 install python-miio
cd ..
You do NOT NEED to reset your robo or change to a device with WIFI. The following command just requires you to know the internal IP of your robot (get it from your router, you may even set the IP to never refresh) and the already existing token (use google for the russian Mi Home app - it was the quickest and easiest way I was able to achieve it):
python3 dustcloud/devices/xiaomi.vacuum/firmwarebuilder/flasher.py -a X.X.X.X -t XXXXXXXXXXXXXXXX -f image/output/v11_001792.pkg
In this case you do not need to setup your WIFI on the robot again, like described at the bottom of this page.
After the successful transfer of the image to the robot, the robot will start flashing the image. This will take about 5~10 minutes. After the process is done, the robot will state that the update was successful.
Eventually, we can log in to our robot via ssh:
ssh root@192.168.8.1
If everything works out, you can now log in to your robot - enjoy.
You're done now using this method. You can proceed to: "Check if dummycloud is correctly set up"
If you face any trouble, check: "Flashing doesn't work"
────────────────────────────────────────────────────────────── Else:
Next, turn your vacuum on and place it in the charger docking station. Connect yourself via WLAN to your robot, the SSID should be sth. like
roborock-vacuum-s5_miap_****
Now we are finally ready to flash the firmware.
IMPORTANT: The flasher scripts will create a web server where the robot will download the firmware image. This means it needs to be able to connect to port 80 on this box. Make sure that the firewall will not block the network access.
Flash the firmware using:
python3 dustcloud/devices/xiaomi.vacuum/firmwarebuilder/flasher.py -f image/output/v11_001712.pkg
After the successful transfer of the image to the robot, the robot will start flashing the image. This will take about 5~10 minutes. After the process is done, the robot will state that the update was successful.
Eventually, we can log in to our robot via ssh:
ssh root@192.168.8.1
If everything works out, you can now log in to your robot - enjoy.
If you face any trouble, check: "Flashing doesn't work"
Assuming you are logged into your robot, we can check if the dummycloud is correctly set up. First, we need to examine if the dummycloud executable is running via
pgrep dummycloud
The result should be a process id number, e.g. 397
.
Next, we have to check the firewall rules, the port 8053
needs to be redirected to127.0.0.1
, so that the robot is communicating with the dummycloud.
Execute
iptables -t nat -L
The result should contain the following:
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DNAT udp -- anywhere ot.io.mi.com udp dpt:8053 to:127.0.0.1:8053
Furthermore, one can verify if the dummycloud is working directly on the robot. If the WiFi LED is constantly on (~30 s after startup), everything is working as expected.
Make sure your firewall is turned off that the robot can connect to your machine for downloading the firmware.
If you know your firewall can't be the reason for it, you may just try it again in the first place.
To integrate the unprovisionised robot to your local WiFi, you need to execute the following on your host PC (not on the robot) to obtain the robot's token:
cd rockrobo
source flasher/venv/bin/activate
mirobo --debug discover --handshake true
The token will be sth. like 456b567549786e6e73754374323*****
.
With this token we can set up the WiFi to which the robot will connect.
mirobo --ip=192.168.8.1 --token=456b567549786e6e73754374323***** configure-wifi YOUR_SSID YOUR_WIFI_PASSWORD
Now the robot will be in your local WiFi and you can give it for example a static ip via your router.
To make sure that no traffic from the robot can escape your local WiFi, you can add the following rules to the firewall of your robot (to make it permanent put in in /etc/rc.local before exit0
):
iptables -A OUTPUT -d 192.168.0.0/16 -j ACCEPT
iptables -A OUTPUT -d 127.0.0.0/8 -j ACCEPT
iptables -A OUTPUT -j DROP
Have fun!
──────────────────────────────────────────────────────────────
If you're familiar with bash and want to play a bit more around, I can give you some advices.
Let's start getting an editor you can at least work with:
apt update && apt install vim
echo "deb http://ports.ubuntu.com/ubuntu-ports/ trusty main universe restricted multiverse
deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main universe restricted multiverse
deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main universe restricted multiverse
deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" > /etc/apt/sources.list
Let's then clean the apt lists and update again:
rm -rf /var/lib/apt/lists && apt update
Now looking at "df -h" will most likely release to you that there is almost no storage. So making some storage "the dirty way": (in this case I decided to free some space to install docker and try my setup from my dedicated host)
mkdir -p /mnt/data/relocated/var/cache && mkdir /mnt/data/relocated/var/lib
mv /var/cache/apt /mnt/data/relocated/var/cache && ln -s /mnt/data/relocated/var/cache/apt /var/cache/apt
mv /var/lib/apt /mnt/data/relocated/var/lib && ln -s /mnt/data/relocated/var/lib/apt /var/lib/apt
mv /usr/local/bin/valetudo /mnt/data/valetudo/ && ln -s /mnt/data/valetudo/valetudo /usr/local/bin/valetudo
mv /usr /mnt/data/relocated && ln -s /mnt/data/relocated/usr /usr
You may want to do an upgrade and have some tools which could be useful, at least for the update process of valetudo itself which I just did yesterday:
apt upgrade; apt install locate wget; updatedb
echo "env VAC_WEBPORT=8080" >> /etc/init/valetudo.conf && service valetudo restart
Note that your web panel is accessible via "http://roborock:8080".
That's it for now, I haven't continued myself further. Please be patient.
Navigation
- Home
- Vacuum Robots
- Lumi Aqara Camera (experimental)
- Lumi Aqara Gateway (new Version, without Homekit)
- Documentation
- Dustcloud