I am wondering if the Xiaomi Mi Robot Vacuum cleaner has some kind of API to control it (start, stop, status, …).
It’s obviously a good choice in terms of price performance.
See a test here (sorry, just in German):
Anyone who has one and tried to re-engineer it?
Thanks!
I actually made some good progress with development in the last few days. Can send &
receive commands. The difficult part of it, getting the cryptographic stuff working has been done.
So I hope to make a rudimentary binding for the vacuum in the near future.
It is approved now, so it should show up in the market place if you have that loaded.
NB, keep in mind you need a very recent OH2 setup (I think build 950 or later) as it uses a recent feature from smarthome.
Note the specific procedure to get the token (if you did not retrieve that before)
Reset the vacuum (no worry, your usage settings remain). This will disconnect it from the normal wifi network.
Connect to it’s wifi hotspot
Run openhab discovery. NB, this needs to be done from the laptop that is connected to the vacuum wifi, not from your normal network.
Openhab should discover the vacuum including the token.
Once openhab has the token, you can link the vacuum back to the normal network with the MiHome app.
Once it is connected back to the normal network, run discovery once more. This will update the IP address to the new IP address of the vacuum.
I recommend to save your token, so you don’t need to repeat this procedure each time you pull an updated version of the binding.
Each time you reset your vacuum, the token is changing, hence this procedure needs to be repeated.
Alternative ways to get the token:
Same procedure, but using the pymirobo application.
Gain root access on your phone, and and open the database from the mihome application. The token is visible in the database
@komissar I think the default setting for the market place is to allow beta plugings.
I marked the binding as alpha, hence also for me it did not show initially.
Go to configuration -> System -> Market and select maturity “Alpha”
That should fix it.
If you get a error like below you need to update your version to a the latest.
20:05:25.378 [WARN ] [ace.internal.BindingExtensionHandler] - Installed bundle, but failed to start it: Could not resolve module: org.openhab.binding.xiaomivacuum [227]
Unresolved requirement: Import-Package: org.eclipse.smarthome.core.cache
Xiaomi changed the Token handling in the last Firmware Version (3.3.9_003074). The token would be changed after the Mi-Home App is connected with the Robot. So you can’t use the initial Token any more. But there is another way. As described here (http://forum.iobroker.net/viewtopic.php?f=23&t=4898&start=800#p71036) you could read the Token from the Mi-Home app.
In short you have to:
Connect the Mi-Home App with the Robot
Change Wlan an Settings
Enable Developer Options in Android
Download the MiToolKit
Connect your Phone to your PC and start the MiToolKit
@p_schlarb,
I don’t have the latest version yet I think, as it still works for me.
The other way I found was indeed reading the mio2db file with sqllite, but that requires you to be able to make a backup (root access) I think the tool you suggest does something similar.
I’ll update my firmware and see if there is an alternative. I have 2 idea’s I want to try out.
(Option 1 would be that after the token is received, the linking to the mi account is done by openhab, option 2 is to log on to the mi account and retrieve it) this may be possible as I noticed that you can use the vacuum from multiple phones without requiring to link it again. The token db is synced over your devices at log on
@marcel_verpaalen
yes you are right, the tool reads the sqlitedb. But you don’t need root access. The Tool creates a backup of the app with the developer access and then reads the sqlite from the backup. There is also a Solution for iOS Users.
Option2 would be realy great cause you don’t need to switch the Wifi on your openHAB Host. Pls let me know if i could support you in any way.
Hey! Received my robot 2 days ago and I’m totally exited to check out your binding! Just updated to openHAB 2.1. For now there is no Xiaomi Robot binding available. I guess it has to get a few adjustments to be compatible with 2.1, right?
Hi,
It should work with the latest 2.1.
Please activate the market place binding and set the market place to also include ‘alpha’ status bindings.
Than it should become visible