Xiaomi Robot Vacuum Binding

that looks nice. Is it right that you define two zones in one command? clean the vacuum than two zones?

Hey,
finally after one day of work and the experience of the other people in this topic i got my xiaomi vacuum v1 working with the “zoned clean up” in openhab, and it works perfectly!

Because i have no android device i had to use an Android emulator and the Flulevac App out of the play store to get the coordinates for the different rooms.

this is my sitemap (i linked the sitemap items with the roborock thing in the paper UI):

Group item=gVac
{
                Switch item=rockrobo_zonecleaning label="Raum Reinigen" mappings=[1="Wohnzimmer",2="Küche",3="Flur",4="Schlafzimmer",5="Badezimmer",6="Kinderzimmer"]
                Switch item=actionControl label="Funktionen" mappings=[vacuum="Start", pause="Pause",spot="Spot", dock="Dock"]
                Switch item=actionFan label="Saugstärke" mappings=[38="Leise", 60="Normal", 77="Power",90="Maximun", -1="Andere"]
                Default item=statusBat label="Batterie"
                Default item=statusArea label="Gereinigte m2"
                Default item=statusTime label="Reinigungszeit"
                Group item=gVacStat label="Status Details"
                Group item=gVacCons label="Gerätezustand"
                Group item=gVacDND label="Nicht Stören"
                Group item=gVacHist label="Reinigungsverlauf"
                Group item=gVacNetwork label="Netzwerk"
}


my items (the Room Switches are visible for Alexa and Homekit):

Switch WZsaugen "Wohnzimmer saugen" [ "Switchable" ]
Switch KZsaugen "Kinderzimmer saugen" [ "Switchable" ]
Switch Kusaugen "Küche saugen" [ "Switchable" ]
Switch Flursaugen "Flur saugen" [ "Switchable" ]
Switch SZsaugen "Schlafzimmer saugen" [ "Switchable" ]
Switch BZsaugen "Badezimmer saugen" [ "Switchable" ]
String Dock "Dock" {channel="miio:vacuum:XXXXXXXX:actions#control"}
String rockrobo_zonecleaning "Zone"

my rules:

rule "Zone Cleaning"
when
Item rockrobo_zonecleaning received command
then
switch (receivedCommand.toString)
{
case "1":
{
        sendCommand(actionCommand,"app_zoned_clean[[25279,23696,30029,27196,1]]")
}
case "2":
{
        sendCommand(actionCommand,"app_zoned_clean[[31403,25481,34203,27131,1]]")
}
case "3":
{
        sendCommand(actionCommand,"app_zoned_clean[[30060,25662,31560,29612,1]]")
}
case "4":
{
        sendCommand(actionCommand,"app_zoned_clean[[26444,27131,30294,30931,1]]")
}
case "5":
{
        sendCommand(actionCommand,"app_zoned_clean[[31157,28018,34107,29668,1]]")
}
case "6":
{
        sendCommand(actionCommand,"app_zoned_clean[[30060,25662,31560,29612,1]]")
}
}
end

//WZ Switch Commands
rule "WZ saugen ON"
when
Item WZsaugen received command ON
then
sendCommand(rockrobo_zonecleaning,1)
end
rule "WZ saugen OFF"
when
Item WZsaugen received command OFF
then
sendCommand(Dock,"dock")
end

//Küche Switch Commands
rule "Ku saugen ON"
when
Item Kusaugen received command ON
then
sendCommand(rockrobo_zonecleaning,2)
end
rule "Ku saugen OFF"
when
Item Kusaugen received command OFF
then
sendCommand(Dock,"dock")
end

//Flur Switch Commands
rule "Flur saugen ON"
when
Item Flursaugen received command ON
then
sendCommand(rockrobo_zonecleaning,3)
end
rule "Flur saugen OFF"
when
Item Flursaugen received command OFF
then
sendCommand(Dock,"dock")
end

//SZ Switch Commands
rule "SZ saugen ON"
when
Item SZsaugen received command ON
then
sendCommand(rockrobo_zonecleaning,4)
end
rule "SZ saugen OFF"
when
Item SZsaugen received command OFF
then
sendCommand(Dock,"dock")
end

//BZ Switch Commands
rule "BZ saugen ON"
when
Item BZsaugen received command ON
then
sendCommand(rockrobo_zonecleaning,5)
end
rule "BZ saugen OFF"
when
Item BZsaugen received command OFF
then
sendCommand(Dock,"dock")
end

//KZ Switch Commands
rule "KZ saugen ON"
when
Item KZsaugen received command ON
then
sendCommand(rockrobo_zonecleaning,6)
end
rule "KZ saugen OFF"
when
Item KZsaugen received command OFF
then
sendCommand(Dock,"dock")
end

//Update Switches when Charging
rule "Saugen Switches OFF"
when
Item statusStatus received update "Charging"
then
postUpdate(WZsaugen, OFF)
postUpdate(Kusaugen, OFF)
postUpdate(SZsaugen, OFF)
postUpdate(Flursaugen, OFF)
postUpdate(BZsaugen, OFF)
postUpdate(KZsaugen, OFF)
end

When the room needs more than one zone just add the coordinates in the actionCommand separated with a comma

I didn´t try, if the zoned clean up has the same coordinates when the roborock made a new map. as long as i only use the zoned clean up the map will be same. for my one level flat without stairs it´s no problem.

at least i want to say thanks for building this binding and everybody here sharing his experiences :slight_smile:

5 Likes

Hello,
can somebody show the items in sitemaps for Reset_Customable? Which is the correct mapping?

Thank you.

In theory yes, but you still need to implement the client.
I give more hope to this project. As far as I understand it basically renders the map on the device itself.
Hence we would not need any client lib to pull the image.

1 Like

I bought a Roborock the other day and installed the Xiaomi Mi Smart Home binding to try linking it to my OpenHab. Is this possible without having a Xiaomi Gateway? This isn’t very clear in the documentation.

You need to extract the token from your roborock as described in the first post of this topic.

I have this string. Not fully tested.

Switch item=ConsumableReset label="Reset []"  icon="reset" mappings=[main_brush_work_time="Hauptbürste", side_brush_work_time="Seitenbürste", filter_work_time="Filter", sensor_dirty_time="Sensor"]

Thank you… that seems to be the correct mapping (the app doesn’t crash if i try to reset the sensors and the remaining percentage now is 100!)

I had the problem with getting the token. The MiToolkit requested a passphrase because the device is encrypted (by default!). A modified Boot-Image must be installed!

With Apple OSX it was quite easier to get the token. A description (in german) is here:

A short description in english:

  • install the mi-home-app via app-store and set up your vacuum.
  • after that make an unencrypted backup of your device
  • open the unencrypted backup with iphonebackupviewer (link is given in the german description)
  • go to appdomain-com.xiaomi.mihome and search for a file beginning with a number and ends with _mihome.sqlite, e.g. 1719973717_mihome.sqlite
  • extract this database and open it with an editor
  • here you can find a 96-digit code containing only numbers and charts (a exemple is shown in german description)
  • copy this 96-digit code in the “input text”-field on aes.online-domain-tools.com, and put 32 zeros in the field “key”.
  • you get a 32-digit decoded token in a table wich you had to insert in “token”-field of the binding.
1 Like

Not quite. Currently, the map is rendered inside the browser so you can’t just fetch an image file. However this is still WIP and I’m not sure how it will turn out

The conversion from 96 digit to 32byte is done by the binding as well. So you can enter the 96 code right in the thing config.

2 Likes

Ah… indeed than that was too optimistic.
But with habpanel can this possible work?

Hi marcel I have a problem binding the xiaomi philips wifi lamp ( https://www.gearbest.com/flush-ceiling-lights/pp_633589.html ).
I have installed both the binding “Xiaomi Mi IO Binding ver. market:binding-3499123 - 1.0” and “Xiaomi Mi Smart Home Binding ver. binding-mihome - 2.3.0.SNAPSHOT” but when I try fo find the lamp I don’t find anything and I proceed with manual binding. I have tried all the combination of device (Xiaomi Mi IO Basic device, Xiaomi Mi IO device, Xiaomi Robot Vacuum, Xiaomi Unsupported Mi IO device) but in any case I was able to control the wifi lamp. I have the token and it works because I also have miivacuum robot and I can see all the info from openhab.
Waiting for your kindly reply.

Have just tried this using the number I got using the text editor method of opening the sqlite file and then just pasted that into the binding. System is online!!

Firmware can be upgraded safely? Binding will work?

i updated, no problem yet

I tried to install my xiaomi vacuum, butter I am not able to start it.
I do not have these switching regulators in my app. do you know why?
many thanks

i got my roborock v2 today and i am trying to extract token as described in the first post.Tried at my marchmellow tablet and on my oreo mobile.I get at the MITOOLKIT something like that:
yeelink.light.color1 - Yeelight 1 - - 192.168.1.106
yeelink.light.color1 - Yeelight 2 - - 192.168.1.111
yeelink.light.strip1 - Yeelight Lightstrip - - 192.168.1.115
yeelink.light.color1 - Yeelight 3 - - 192.168.1.104
roborock.vacuum.s5 - Roborock Vacuum - - 192.168.1.137
yunmi.kettle.v2 - Mi Smart Kettle - - 46.190.29.148, 46.190.29.148

All devices are there but no token.What am i doing wrong here?

got myself,i downgraded the mihome app and tokens appeared.

can you please help me?