Xiaomi Robot Vacuum Binding

Ok, and the control function of the robot itself?

The must relevant ones are included.
Any particular control you miss?

The ones to control the vacuum manually by remote control. But maybe they are already existing. I will take a look again.

Thank you.

Another thing im trying to do right now is to access the functionality with the amazon echo (alexa).
This should work similar to the other smart home functions like lights/rollershutters by adding the flag [ “Lighting” ] or [ “Switchable”], shouldn’t it? I just have to write a rule for this in order to send the correct command instead of ON, OFF.

Kind regards

Okay, i got it.

Because of the current restrictions of the openhab hab smart home bindings, its only possible to turn ON/OFF your cleaner. But i think this is enough for the moment. With some tricks you can use more functions i think e.g. using more rules etc.

But for now if anyone want to use its cleaner with the amazon echo (alexa) you can just add another binding like this.

Switch FF_Cleaner  "Staubsauger Bruce"    [ "Switchable" ] channel="miio:generic:02EB9016:actions#control" }
rule "FF_Cleaner_ON"
when
	Item FF_Cleaner received command ON
then 
	sendCommand(actionControl, "vacuum");
end

rule "FF_Cleaner_OFF"
when
	Item FF_Cleaner received command OFF
then 
	sendCommand(actionControl, "dock");
end

The “actionControl” item is the existing one from marcel’s items page.

String actionControl  	"Vacuum Control"   (gVac)     [ "Switchable" ]	{channel="miio:generic:02EB9016:actions#control" }

Cheers

1 Like

@pheelLikeWater
I’ve added the possibility to send on and off to the binding. Will be available in 20 min in the market

So now both on and vacuum are triggering the vacuum. Same with off and dock.

15 Oct 2017 updated version

  • Added channels for last cleaning details @staehler67
  • Allowed to send on & off to the vacuum to start & stop vacuum to allow to used with Alexa voice control @pheelLikeWater
  • configurable timeout in case of poor connection

As channels & config have been updated, best to remove your thing and add it again if you want to use these new features
to update, uninstall and reinstall from the market.

2 Likes

Hi,

Thank you very much for this project. I can’t seem to get my setup working, however.

I’m trying to setup my Xiaomi Mi Vacuum with Openhab running on my PC. I do not want the vacuum cleaner to talk to the outside world. I do not need the app to function. You mentioned a couple of posts up that I should therefore do the following:

  • Reset wifi
  • Connect to the Xiaomi hotspot with Openhab
  • Do a discovery (the token will automatically be captured)
  • Finalize the WiFi setup using the miIO.config_router command.

All steps succeed, except for the last one, probably because I do not know the correct syntax. So the robot is discovered, an I am able to send commands:

xiaomi

I tried a couple of syntaxes, e.g. miIO.config_router({"ssid":"WInternal","passwd":"xxx"}), however I can’t get it to work. Here you mention that the wifi password’s transmission is not following JSON standards, however I can’t seem to figure out what is the standard syntax I should follow.

So if i want to use it with echo or google home i need to add a rule with the command on and of right?

rule "Robo_ON"

when

	Item actionControl received command ON

then 

	sendCommand(actionControl, "vacuum");

end

rule "Robo_OFF"

when

	Item actionControl received command OFF

then 

	sendCommand(actionControl, "dock");

end

Or do i need a seperate item like @pheelLikeWater wrote it a few rows above?!

@Multisaft7 i tried it as u before, but it didn’t work for me.
Cause alexa sent values 0 for off and 100 for on when i ask to turn on the cleaner. And the only value which was set was “dock” when using only the actionControl item.

Maybe u can test it by changing the rule in order to handle events for 0 and 100. But with the current item “actionControl” which is a string you are not getting “ON” and “OFF” as values.

1 Like

But what were the changes @marcel_verpaalen did in his latest release for a better alexa voice control?!

The changes were made to use the echo without any rules i think. I will test it as soon as possible.

I seemed to have more luck with miIO.config_router{“tz”:“Europe/Brussels”,“gmt_offset”:0,“ssid”:“WInternal”,“passwd”:“xxx”}
This was inspired on the perl code found here: https://forum.fhem.de/index.php/topic,73052.0.html

=> this gave [OK] and then the robo hotspot disappeared and I saw that it connected to the network. However, I cannot get my cleaner to work then, so it seems there is another part of the pairing which is lacking…

Any idea how to proceed?

@Multisaft7 Carsten, my change was that the channel now also supports on & off as commands, where on = vacuum & off = dock

So my assumption is that this should avoid that you need a rule for it.
If like @pheelLikeWater indicates Alexa sends values 0 & 100, indeed it still won’t work.

@pheelLikeWater : is Alexa also expecting the channel to provide an of or off for its working?

I think indeed that changed with the latest firmware which has the timezone information in it (specifically used for the timing of the automatic cleaning schedule). Older firmware versions did not require this.

What is important to know that once you change it, it won’t work anymore via the Mi Home app. The app is not connecting anymore. Next thing you need to get is the new IP address. Best thing is to note your token, and remove your thing again so it can be discovered again on your regular network. Alternatively you can try to see on your DHCP server (e.g. for most folks your wifi router) if the vacuum is connected and what is the new IP.

Is your vacuum on the new network & discovered again?
What is the error you encounter? (timeouts on commands, or no pings?)

Okay then it should still not work. Because you have to change the current item from string to a switch.

1 Like

Ok, so the ‘WInternal’ network is a network which could not communicate with the outside world. It seems that is part of the problem. I opened it up, did the WiFi reset again, issued the command miIO.config_router{“tz”:“Europe/Brussels”,“gmt_offset”:0,“ssid”:“WInternal”,“passwd”:“xxx”}, and it appeared on the WInternal network as ‘rockrobo’.

Then, I manually added this with the new IP and the same token as a new vacuum cleaner in OpenHab, At first it showed online, but sooned turned to offline with ‘configuration_error’. Can I debug this further?

Perhaps it’s just not possible anymore to do this without the app, as in reply 2 on this forum https://forum.fhem.de/index.php/topic,73052.0.html that possibility has been striked through. However, the wifi pairing succeeds, it’s just after the pairing that I seem to have lost the control.

Your ‘’ At first it showed online, but sooned turned to offline with ‘configuration_error’." indicates a token problem.
This maybe has to do that with the latest firmware (3.3.9_003077) the token is changing after the connection with mi cloud.

Earlier versions this did not happen. I’ve currently connected my miio philips led bulbs in the same way you described, these remain working,

So, just a though:
What happens if you temporary open your WInternal network to the internet. Connect with the mi home app your device to the WInternal network. Once connected (and you can read your new token from the mi app) you disable access to the internet for the WInternal network.

I think I tried that before, but I had problems as well. Perhaps I should try that again.
Anyway, if there is a token error, shouldn’t it give a debug error that decryption failed or something? It just says there is no response.

[DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for ece705f4 type: MIIO_INFO, result: null, fullresponse: {"error":"No Response"}

Unfortunately the robot just gives no response on a token error. Hence the more recent versions of the binding change the status to configuration error if for several times the device is pingable, but no response to commands.

The communication between the vacuum & the cloud is still not deciphered. (not many folks attempted it either)
Once that is logged & understood the changing of the token is maybe controllable.

The only hint I have is that the token is not fully random, but has the time element in it.
Meaning it is some fixed secret + time (probably the first time the token is requested) offset.