Disconnecting the S5 Max vacuum from the cloud
2023-03-05I had thought of pretending I went down the following small rabbit hole strictly for privacy reasons, but really its because I can’t resist installing something new on an item I own. Today’s victim was our Roborock S5 Max robot vacuum.
We’ve had it for a while and like everyone with a robot vacuum cleaner we have thoroughly enjoyed watching it potter around the house in its very organised way. Its certainly an upgrade over the old iRobot Discovery I used to have, though that was certainly more organic in its cleaning approach and far more fun to watch bumbling around.
I had heard of Valetudo a while ago when researching how to connect to the S5 to Home Assistant, and had some free time this afternoon to give it a go. It offers a way to control your robot vacuum locally on your own network, removing the reliance on Xiaomi’s cloud.
Like I said before it mainly appealed to me because its fun to fiddle with electronics but the idea of disconnecting from Xiaomi’s cloud was quite appealing, the app isn’t too bad but one less app is always good, and it means everyone in the house can access the robot without making accounts and me sharing the device. Now quite rightly, from my experiences today, the Valetudo website sets out saying that this isn’t for everyone as it definitely isn’t as slick, simple, or foolproof as using the normal Xiaomi app, but for those willing to go through the process it seems beneficial. I kind of feel if you’ve gone far enough to wonder if there is a custom firmware for your fancy toy, then you’ve probably already decided to give it a go.
I won’t provide a guide here or talk through every step I took as the guides on the Valetudo website are fantastic and almost covered every question I had.
The general process for most devices seems to be as follows: root->custom firmware->install Valetudo. Sadly (or not depending on what you find fun) the two ways to root the S5 Max involve almost completely disassembling the robot. Luckily I absolutely love taking things apart, and the S5 Max was quite impressive in that regard. Everything was very modular, the bottom and top covers were easy to remove, the LIDAR and rotary brush come out as complete units with a push fit connector and spring loaded contacts respectively, the battery is sealed in a plastic case with pull tabs for removal, and everything else looks like it would be very easy to replace once you’re in there.
Taking apart a hoover is a good opportunity to clean it, you realise how grimy they get once you start getting inside. The S5 did a really good job of keeping dust out of the internals, though that didn’t stop dust getting everywhere. Apologies for the gratuitous dust pics.
Dennis Giese has set up an amazing and essential online build system called DustBuilder. I can’t express just how good this is. You pick your device, a few options, input your email, and then a few minutes later you get a link to the rooting files, custom firmware, and all the scripts you need.
My target for the preferred flashing option was on the underside of the motherboard, test point 17. Connecting this to ground while powering on the unit (and holding the power button) should put the device into FEL mode. I haven’t worked with this particular embedded prococessor but I assume this is a recovery / bootloader mode on Allwinner devices that lets you program the device over USB.
It wasn’t too difficult to get this stage done, plug in a usb cable, and see the FEL device show up when running lsusb, but the scripts in the dustbuilder package kept failing to find the FEL device. I went around and around on this issue, assuming it was something specific to my vacuum, or maybe the latest version of the firmware I had. I had started down the other rooting path which involves connecting to the serial console and interrupting uboot, when I realised I should probably check another computer just to make sure it wasn’t a permissions issue or something similar. Of course the script immediately worked on my old backup laptop, cue the closing or 10 tabs, the switching off of the soldering iron, and a sigh of relief.
After that bump the process was really smooth, following the guide I sent the custom firmware package over and installed it, then sent over the valetudo app. Immediately I could access the built in webserver on the vacuum and see the map of the house. There is something quite pleasing about being able to connect directly to the robot to change settings or start cleaning, rather than bouncing out to the cloud somewhere every time you want to look at the map or check the battery.
Integration with home assistant was super easy too, after setting up the MQTT settings on the vacuum a big list of new entities turned up. I haven’t quite looked into it yet but it seems like there are some custom front end cards that support displaying the map too.
All in all, if it wasn’t for my bad laptop set up this wouldn’t have taken very long at all. I suppose really now I should investigate whats up with the USB permissions on my laptop, but I foresee another post in the future where I get stuck in exactly the same place…