Xiaomi Mi Robot

I think you need python 3.5 version to run it.

I tried to update to Python 3.5, but it’s the same.

There is also checking the Python version in cli.py and Python 3.4 should be fine.
if sys.version_info < (3, 4):
print(“To use this script you need python 3.4 or newer, got %s” %
sys.version_info)
sys.exit(1)

So the problem is now fixed and I’m able to use the connection.
Important note for everybody using Xiaomi Vacuum Cleaner with firmware 3.3.9. It is no longer possible to retrieve the token using discover mode. The only possible way is to get token from your Android or iOS device that was previously paired with your vacuum cleaner: https://github.com/home-assistant/home-assistant.github.io/blob/next/source/_components/switch.xiaomi_vacuum.markdown

Is it still possible to retrieve the token with the Mi Toolkit?

I have done a dump of the communication on signin for the Xiaomi App, including the device download. Is anyone interested in seeing that to see if we can get the token from that? Skimming through it the responses are somehow encoded (not plain json or xml)

Sure, that may help indeed. There are still quite some questions left in that area,

1 Like

Hi, this is a non-geek question

for the common user, is there a way to control the Xiami mi vacuum cleaner either directly on the cleaner itself, or at least communication with it through an iPod 6 gen without internet connection ? I don’t want to send any information whatsoever to the Chinese.

Thanks

The binding uses direct control (local/ direct), no communication via the cloud.
You can deny internet access for the vacuum if you control it via the binding.
So, the short answer, yes, you can control it without ever connecting it to the internet if you want.

ok, did I understood wrongly when I supposed I needed a one-time internet connection through the device I wanted to use with the Xiami for registration purposes ?

What exactly am I supposed to install on my iPod in order to operate this direct control ?
Thanks

Okay, I think you can control your vacuum through openhab without ever connecting it to Xiaomi cloud.

The way to do it is to look at the first post on how to retrieve the token (connecting openhab to the device wifi network, run discover for the token).
Once you have the token, use the command channel to send the command for changing the wifi network. miIO.config_router , use as param ssid & password with your desired wifi network. I see I haven’t documented that command yet. I’m away from home this weekend, can add that after the weekend

Than the vacuum will connect to your home network. You can than run openhab on your local network, have the webbrowser or ios app for openhab to control it.

Above way, you never need to connect it to internet. The disadvantage is that the Xiaomi mihome app can’t be used.
If you want to use the Xiaomi mihome app, you need to do the wifi network change via the Xiaomi app at that time its connected to the internet.
Once linked to the mihome app internet access is no longer needed.

Hope the 2 options are clear.

OK, did anyone actually tried to control his Xiami with this ?

Recently the “find_me” command stopped working. The error I get is as follows:

[ERROR] [.thing.internal.CommunicationManager] - Exception occurred while calling handler: java.lang.IllegalStateException: This is not a JSON Array.
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: This is not a JSON Array.
	at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:220) [98:org.eclipse.smarthome.core:0.9.0.201709011622]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189) [98:org.eclipse.smarthome.core:0.9.0.201709011622]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83) [98:org.eclipse.smarthome.core:0.9.0.201709011622]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67) [98:org.eclipse.smarthome.core:0.9.0.201709011622]
	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.receiveCommand(CommunicationManager.java:74) [105:org.eclipse.smarthome.core.thing:0.9.0.201709011622]
	at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:47) [98:org.eclipse.smarthome.core:0.9.0.201709011622]
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:193) [98:org.eclipse.smarthome.core:0.9.0.201709011622]
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1) [98:org.eclipse.smarthome.core:0.9.0.201709011622]
	at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181) [98:org.eclipse.smarthome.core:0.9.0.201709011622]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.IllegalStateException: This is not a JSON Array.
	at com.google.gson.JsonElement.getAsJsonArray(JsonElement.java:106) ~[?:?]
	at org.openhab.binding.miio.internal.MiIoCommunication.sendCommand(MiIoCommunication.java:73) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoAbstractHandler.sendCommand(MiIoAbstractHandler.java:165) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoVacuumHandler.handleCommand(MiIoVacuumHandler.java:96) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.CommunicationManager$1.call(CommunicationManager.java:77) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.CommunicationManager$1.call(CommunicationManager.java:1) ~[?:?]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:218) ~[?:?]
	... 12 more

Yep, and it works great.

ok, sounds encouraging.

Just a question, maybe i should start a new topic for that, but is this possible with a raspberry pi rather than with my iPod ?

Yes, that is unfortunately an error that was introduced in the last version by my ‘check for valid json’ change.
It will be fixed in the next update.

Does anyone know when the second generation will be available in Europe and if it will still work with the binding? Mi 10 year old Roomba is having problem with my black carpet and its either a new carpet or new vacuum cleaner, but I think I will wait to new version is out,…

@skatun that is unknown currently. These products should be starting shipment in the next few weeks from the Chinese webshops, but it is unclear if the protocol/commands between the 2 vacuums are equal.

@marcel_verpaalen Hi Marcel, is there a chance, to get the last run (date, time) of the vac cleaner? I didn’t find this in your items, but it’s available in den history of the Mi App.
Kind regards,
Michael

Yes, this can be retrieved via the clean_history command https://github.com/marcelrv/XiaomiRobotVacuumProtocol/blob/master/cleanSummary%2Bdetail.md

You can currently get it via a rule via the command channel.
If it is helpful I can see if I can add some channels for it

Would be nice if you find the time to enhance your binding with this additional channel. Many thanks for your efforts.