Xiaomi Robot Vacuum Binding

binding
vacuum
xiaomi
Tags: #<Tag:0x00007fd31437c7d0> #<Tag:0x00007fd31437c4d8> #<Tag:0x00007fd31437c370>

(Tom) #674

I get the same error in my log.

2018-07-02 21:01:10.093 [ERROR] [org.openhab.binding.miio            ] - [org.openhab.binding.miio.internal.discovery.MiIoDiscovery(21)] The activate method has thrown an exception
java.lang.IncompatibleClassChangeError: Expected non-static field org.openhab.binding.miio.internal.discovery.MiIoDiscovery.scheduler
	at org.openhab.binding.miio.internal.discovery.MiIoDiscovery.startBackgroundDiscovery(MiIoDiscovery.java:80) ~[?:?]
	at org.eclipse.smarthome.config.discovery.AbstractDiscoveryService.activate(AbstractDiscoveryService.java:403) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:229) ~[42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39) ~[42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:650) ~[42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:506) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:307) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:299) [42:org.apache.felix.scr:2.0.12]

Using:
org.openhab.binding.miio-2.4.0-SNAPSHOT
openHAB 2.2.0-1 (Release Build)

Not sure whether I missed the solution and/or I’m using the wrong mix of openHAB and binding versions.

Anyone know?

Thanks!


(Andrew Pawelski) #675

Can anyone tell me if the IOS token is still supported?


(marcel) #676

Hi, I have not read anywhere that a change was made to the IOS token logic, but it is very well possible.
The IOS token has some additional encryption which the Android app does not have.

If you have both android as well as an IOS device you may test if they both come to the same key. (IOS decrypted key can be seen in the log when put in debug mode)


(Andrew Pawelski) #677

It could be something on my system however I have a couple of other devices I am not having an issue with. The devices are also not being discovered at all which I find odd


(apfelflo89) #678

Its because of the space, that escapes the .map, what you need to do is a "/ " within the text you want to transform.
like:

Returning\ Dock=FERTIG  ✔

(Jack Sand) #679

Thankyou for this exellent binding
Ps had to downgrade Android app
Note: latest Android MiHome no longer has the tokens in the database. Use 5.0.19 version 63, see link in the post earlier

This worked

Does the binding directly communicate to the vacuume or via the cloud?


(marcel) #680

It communicates to the vacuum, no connection by the binding to the cloud.


(Igor) #681

One more way to get Yeelight devices token:
In case you have rooted Android phone with latest version of Mi Home , look for directory /data/data/com.xiaomi.smarthome/shared_prefs
Inside this directory you can find files with name like this YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY_XXXXXXXX.xml
Firs part of the file name is token, second part is device ID.
Other then Yeelight devices do not have such files…


(Christopher Hemmings) #682

Hey all. I have this working great. Ive been able to set zones using my sitemap

	Switch item=tempCommand label="" icon="" mappings=[Zone1="Dining",Zone2="Lounge",Zone3="Main Bedroom"]

And rules

//***************************************************************************
rule"Zone1 Cleaning"
when
	Item tempCommand received command Zone1
then

			actionCommand.sendCommand("app_zoned_clean[[25300,20000,29500,28000,1]]")


end
//***************************************************************************
rule"Zone2 Cleaning"
when
	Item tempCommand received command Zone2
then

			actionCommand.sendCommand("app_zoned_clean[[23300,16500,28200,20000,1]]")


end

//***************************************************************************
rule"Zone3 Cleaning"
when
	Item tempCommand received command Zone3
then

			actionCommand.sendCommand("app_zoned_clean[[29500,16500,34599,20000,1]]")


end

But I have a rug in my dining room, If i want to mop, i need to set 4 zones. How can i send 4 seperate zones to the actionCommand?

Or is there a better way to send the command.

Thanks.


(Christopher Hemmings) #683

Nevermind, Fixed by adding new arrays with a comma,
i.e.

"app_zoned_clean[[29465,16491,33565,20191,1],[29477,20162,30927,21812,1]]"

(Peter Ka) #684

i will share my little experience with zone cleaning:

  1. problem:
    i was able to export by flolevac app the coordinates of different rooms. so i thought it would be easy to clean different rooms. But i realised that sometime the coordinates of my rooms were wrong. i checked the map in the flolevac app and saw that the map was “turned”

  2. solution:
    i changed the location of the dock station in a small corner. the area is like a labyrinth. every time i start cleaning the map will be exactly the same

  3. use of openhab:
    i modified the rule to be sure that the map is always correct. so first i start normal cleaning and after a few seconds i start zone cleaning. for other rooms i first go to the corridor so it is easier for the robot to start zone cleaning in another room:

var Timer waitTimer1 = null
var Timer waitTimer2 = null
var Timer waitTimer3 = null
rule "Zone Cleaning"
 when
    Item rockrobo_zonecleaning received command
 then
  switch (receivedCommand.toString) {
    case "1": {
		sendCommand(rockrobo_action_command,"app_start")
		waitTimer1 = createTimer(now.plusSeconds(60), [|
			sendCommand(rockrobo_action_command,"app_pause")
			waitTimer1 = null
		])
		waitTimer2 = createTimer(now.plusSeconds(90), [|
			sendCommand(rockrobo_action_command,"app_zoned_clean[[25642,25208,29942,32808,1],[23206,27129,25856,29829,1]]")	
			waitTimer2 = null
		])		
          }
    case "2": {
		sendCommand(rockrobo_action_command,"app_start")
		waitTimer1 = createTimer(now.plusSeconds(60), [|
			sendCommand(rockrobo_action_command,"app_pause")
			waitTimer1 = null
		])
		waitTimer2 = createTimer(now.plusSeconds(90), [|
			sendCommand(rockrobo_action_command,"app_goto_target[23000,28550]")
			waitTimer2 = null
		])
		waitTimer3 = createTimer(now.plusSeconds(240), [|
			sendCommand(rockrobo_action_command,"app_zoned_clean[[20665,27319,23265,29419,1],[20520,23765,21920,27365,1]]")
			waitTimer3 = null
		])
        }		
  }
  end 

(Peter Ka) #685

Will this help to get the map of the robot?
https://github.com/SG-O/miIOMapServer


(Miriam) #686

Hello,
I download and installed this binding today – great job!
But… I have one problem.
I had defined the item xy_ResetConsumable (where xy is myRoborock). Resetting the Consumables via PaperUI works fine, but I don’t know to set up the item in my sitemap.
Can you please help me with the correct definition of mappings (I think this is the main problem)?
I tried with

Selection item=xy_ResetConsumables mappings=[resetMainbrush=“ResetMainBrush”, resetFilter=“ResetFilter”, resetSensors=“ResetSensors”, resetSidebrus=“ResetSidebrush”]

and

Selection item=xy_ResetConsumables mappings=[Mainbrush=“ResetMainBrush”, Filter=“ResetFilter”, Sensors=“ResetSensors”, Sidebrus=“ResetSidebrush”]

but both variants doesn’t work.

Sorry if the question seems to be too easy, but I’m new.


(Brian M. Pedersen) #687

When vacuuming with defined coordinates, is the origin (0,0) defined as the charging station?


(Christopher Hemmings) #688

Download flolevac on Android and connect to you it vac through that. You can set a zone using the map and hold down the go button it will copy the coordinates


(Cernon) #689

in an other thread I found the info that the station has the coordinates 25500/25500. Every mm is one point, more to right and forward and less to left and backward. That works for me, so I don’t need an App.


(Cernon) #690

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


(Adrian Bonacker) #691

(post withdrawn by author, will be automatically deleted in 96 hours unless flagged)


(Adrian Bonacker) #692

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:


(Miriam) #693

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

Thank you.