Xiaomi Robot Vacuum Binding

binding
vacuum
xiaomi
Tags: #<Tag:0x00007fd312412160> #<Tag:0x00007fd312411f80> #<Tag:0x00007fd312411c88>

(Ondrej Pecta) #670

Yeah, sorry, I did not mention it - all the communication with the device is crypted so I enclosed the decrypted Wireshark data.
As far as I understand your answer, even the yeelight example is not applicable since it uses unencrypted way of communication, right?


(Federico Garcia) #671

I have some issues to switch off yeelink.light.color1 using the Color item, when I send the comand “0,0,0”
I get this on the log:
GF_Office_LightRGB_Color changed from 0,100,100 to 0,0,0
GF_Office_LightRGB_Color changed from 0,0,0 to 0,100,100

(it change back inmeditly)
this is the only yeelight that I have. but I have serveral other Color Items that do not has this behaivor.


(Cernon) #672

Hello, I have the vacuum und its works fine with openhab. Only the zone cleaning don’t work as expected. Other user described it at all. My question: has somebody a working transform.map to German for the Error und status message? I can’t transform “no error”?!?


(Andrew Pawelski) #673

I’m getting
“gave error Given final block not properly padded. Such issues can arise if a bad key is used during decryption” errors in my log file I have checked the IOS token is correct, I see above many people seem to have same issue but no real resolution. Ive forced a token change with the same issue still.


(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.