Xiaomi Robot Vacuum Binding

@marcel_verpaalen How can I force a Thing to do an online token check?
So I have the Things added to openHAB, I have changed the address to its new address (moved Wi-Fi config) and if I clear the token, should it start the token discovery?

Hi Marcel,
I have a yeelight strip v2 wich isn’t findable via the cloud connection. Every other device is there, just the one new strip is missing.
Do you have a hint?

Hello,
i have the problem that after running Openhab for a few hours,my S5 will cycle every few minutes between ONLINE and OFFLINE. But the robot is definitely online. After a restart of the binding via Karat everything runs normally for some time. A restart of the robot does not help. In the log it looks like this:


2020-06-05 17:47:13.124 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Communication error for Mi device at 172.16.1.92: Receive timed out

2020-06-05 17:47:13.125 [DEBUG] [nal.transport.MiIoAsyncCommunication] - No response from device 0F906235 at 172.16.1.92 for command {"id":10670,"method":"get_consumable","params":[]}.

2020-06-05 17:47:13.126 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0F906235 (172.16.1.92)
2020-06-05 17:47:13.130 [DEBUG] [nal.transport.MiIoAsyncCommunication] - **Ping 0F906235 (172.16.1.92) success**
2020-06-05 17:47:13.132 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0F906235 type: CONSUMABLES_GET, result: {}, fullresponse: {"error":"No Response"}
2020-06-05 17:47:13.133 [DEBUG] [internal.handler.MiIoAbstractHandler] - Error received: "No Response""

Any hints?
Regards,
Olli

P.S.: I’ running the latest snapshot of openhab and valetudeo 0.95 re based on 2020 firmware on the bot

@rkrisi Hi Kristof. I was able to solve this by setting the log level to debug.
Altough my device was automatically added to the inbox, the token was never added and the thing (vacuum) kept its degraded status.
I set the binding log level to Debug in the console (log:set DEBUG org.openhab.binding.miio) and the token was displayed in the log.

So for me the token was never inserted into the discoverd thing, but was displayed in the debug log like :

2020-06-05 19:23:01.654 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Cloud Info: Device name: 'Roborock S6', did: 'XXXXXXX', token: 'XXXXXXXXXXXXXXXXXXXXXXXX', ip: 345.168.444.234, server: de

Maybe this could benefit you

If the cloud connection is there, it will do that with the next discovery. So just initiating a discovery will do the trick. (I recall there is some limited ‘no refresh’ time of 1 minute, so if you would do it within that minute the cloud data will not be refreshed)

please share a debug log, to understand what is going on.

Very nice and detailed explanation! One question, how do you get the room coordinate (19 for example)? And does this include mopping?

Hi,

I’ve been using the binding for some time now, and it worked quite well. A few days ago, I moved my OpenHAB to a fresh install of 2.5.5 on RPi4; Now, my two robot v1’s stopped working - my roborock s5e is running fine.

I worked through this thread, and tried to include the model - but that changes nothing.

Tokens and devices are discovered and shown in the logs.

I checked (and copy&pasted) deviceID and Token from the log into the config multiple times. The log gives me the same tokens and IDs as are in the config files.

However, the v1 robots keep hanging in HANDLER_CONFIGURATION_PENDING and stay there forever. It doesn’t seem that any communication is attempted towards the robot.

openhab.log:

2020-06-07 16:33:18.842 [DEBUG] [internal.handler.MiIoAbstractHandler] - Disposing Xiaomi Mi IO handler 'miio:vacuum:mimi'
2020-06-07 16:33:18.870 [DEBUG] [internal.handler.MiIoAbstractHandler] - Disposing Xiaomi Mi IO handler 'miio:vacuum:heinzelmann'
2020-06-07 16:33:18.872 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Finished Mi IO MessageSenderThread
2020-06-07 16:33:18.893 [DEBUG] [internal.handler.MiIoAbstractHandler] - Disposing Xiaomi Mi IO handler 'miio:vacuum:momo'
2020-06-07 16:33:18.942 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Receiver thread received SocketException: Socket closed
2020-06-07 16:33:18.943 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Receiver thread ended
2020-06-07 16:33:18.943 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Stop Xiaomi  Mi IO background discovery
2020-06-07 16:33:19.205 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Xiaomi cloud login with userid xx@xxxxxx.de
2020-06-07 16:33:19.220 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Start Xiaomi Mi IO background discovery
2020-06-07 16:33:19.224 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Getting new socket for discovery
2020-06-07 16:33:19.226 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Starting discovery receiver thread for socket on port 45988
2020-06-07 16:33:19.232 [DEBUG] [l.discovery.MiIoDiscoveryParticipant] - mDNS rockrobo-vacuum-v1 identified as thingtype miio:vacuum with did 046EC36B (74367851)
2020-06-07 16:33:19.234 [DEBUG] [l.discovery.MiIoDiscoveryParticipant] - mDNS rockrobo-vacuum-v1 identified as thingtype miio:vacuum with did 04EB89B0 (82545072)
2020-06-07 16:33:19.236 [DEBUG] [l.discovery.MiIoDiscoveryParticipant] - mDNS roborock-vacuum-s5e identified as thingtype miio:vacuum with did 132DE7BA (321775546)
2020-06-07 16:33:19.501 [DEBUG] [internal.handler.MiIoAbstractHandler] - Initializing Mi IO device handler 'miio:vacuum:heinzelmann' with thingType miio:vacuum
2020-06-07 16:33:19.502 [DEBUG] [internal.handler.MiIoAbstractHandler] - Polling job scheduled to run every 30 sec. for 'miio:vacuum:heinzelmann'
2020-06-07 16:33:19.512 [DEBUG] [internal.handler.MiIoAbstractHandler] - Ping Mi device 132DE7BA at 10.36.38.130
2020-06-07 16:33:19.514 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 132DE7BA (10.36.38.130)
2020-06-07 16:33:19.520 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 132DE7BA (10.36.38.130) success
2020-06-07 16:33:19.521 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Starting Mi IO MessageSenderThread
2020-06-07 16:33:19.522 [DEBUG] [internal.handler.MiIoAbstractHandler] - Ping response from device 132DE7BA at 10.36.38.130. Time stamp: 2020-06-07T16:33:19, OH time 2020-06-07T16:33:19.522, delta 0
2020-06-07 16:33:19.525 [DEBUG] [o.internal.handler.MiIoVacuumHandler] - Refreshing miio:vacuum:heinzelmann:actions#control
2020-06-07 16:33:19.525 [DEBUG] [o.internal.handler.MiIoVacuumHandler] - Refreshing miio:vacuum:heinzelmann:status#clean_time
2020-06-07 16:33:19.526 [DEBUG] [o.internal.handler.MiIoVacuumHandler] - Periodic update for 'miio:vacuum:heinzelmann' (miio:vacuum)
2020-06-07 16:33:19.526 [DEBUG] [o.internal.handler.MiIoVacuumHandler] - Refreshing miio:vacuum:heinzelmann:actions#fan
2020-06-07 16:33:19.526 [DEBUG] [o.internal.handler.MiIoVacuumHandler] - Refreshing miio:vacuum:heinzelmann:status#battery
2020-06-07 16:33:19.527 [DEBUG] [o.internal.handler.MiIoVacuumHandler] - Refreshing miio:vacuum:heinzelmann:status#clean_area
2020-06-07 16:33:19.529 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":1,"method":"get_dnd_timer","params":[]} -> 10.36.38.130 (Device: 132DE7BA token: 54456B69XXXXXXXXXXXXXXXX54713439 Queue: 1)
2020-06-07 16:33:19.531 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 132DE7BA (10.36.38.130)
2020-06-07 16:33:19.537 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 132DE7BA (10.36.38.130) success
2020-06-07 16:33:19.539 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":2,"method":"get_clean_summary","params":[]} -> 10.36.38.130 (Device: 132DE7BA token: 54456B69XXXXXXXXXXXXXXXX54713439 Queue: 2)
2020-06-07 16:33:19.541 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 132DE7BA (10.36.38.130)
2020-06-07 16:33:19.546 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 132DE7BA (10.36.38.130) success
2020-06-07 16:33:19.550 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":3,"method":"get_status","params":[]} -> 10.36.38.130 (Device: 132DE7BA token: 54456B69XXXXXXXXXXXXXXXX54713439 Queue: 3)
2020-06-07 16:33:19.553 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 132DE7BA (10.36.38.130)
2020-06-07 16:33:19.558 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 132DE7BA (10.36.38.130) success
2020-06-07 16:33:19.560 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":4,"method":"miIO.info","params":[]} -> 10.36.38.130 (Device: 132DE7BA token: 54456B69XXXXXXXXXXXXXXXX54713439 Queue: 4)
2020-06-07 16:33:19.562 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 132DE7BA (10.36.38.130)
2020-06-07 16:33:19.571 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 132DE7BA (10.36.38.130) success
2020-06-07 16:33:19.572 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":5,"method":"get_consumable","params":[]} -> 10.36.38.130 (Device: 132DE7BA token: 54456B69XXXXXXXXXXXXXXXX54713439 Queue: 5)
2020-06-07 16:33:19.573 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 132DE7BA (10.36.38.130)
2020-06-07 16:33:19.580 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 132DE7BA (10.36.38.130) success
2020-06-07 16:33:19.582 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":6,"method":"get_map_v1","params":[]} -> 10.36.38.130 (Device: 132DE7BA token: 54456B69XXXXXXXXXXXXXXXX54713439 Queue: 6)
2020-06-07 16:33:19.583 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 132DE7BA (10.36.38.130)
2020-06-07 16:33:19.587 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 132DE7BA (10.36.38.130) success

events.log:

2020-06-07 16:33:18.831 [hingStatusInfoChangedEvent] - 'miio:vacuum:mimi' changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING) to UNINITIALIZED
2020-06-07 16:33:18.849 [hingStatusInfoChangedEvent] - 'miio:vacuum:mimi' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2020-06-07 16:33:18.850 [hingStatusInfoChangedEvent] - 'miio:vacuum:heinzelmann' changed from ONLINE to UNINITIALIZED
2020-06-07 16:33:18.863 [vent.ItemStateChangedEvent] - health_heinzelmann changed from ONLINE to UNINITIALIZED
2020-06-07 16:33:18.880 [hingStatusInfoChangedEvent] - 'miio:vacuum:heinzelmann' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2020-06-07 16:33:18.881 [hingStatusInfoChangedEvent] - 'miio:vacuum:momo' changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING) to UNINITIALIZED
2020-06-07 16:33:18.903 [hingStatusInfoChangedEvent] - 'miio:vacuum:momo' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2020-06-07 16:33:19.486 [hingStatusInfoChangedEvent] - 'miio:vacuum:heinzelmann' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2020-06-07 16:33:19.497 [vent.ItemStateChangedEvent] - health_heinzelmann changed from UNINITIALIZED to INITIALIZING
2020-06-07 16:33:19.510 [hingStatusInfoChangedEvent] - 'miio:vacuum:heinzelmann' changed from INITIALIZING to OFFLINE
2020-06-07 16:33:19.516 [hingStatusInfoChangedEvent] - 'miio:vacuum:momo' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to UNINITIALIZED (HANDLER_CONFIGURATION_PENDING)
2020-06-07 16:33:19.517 [hingStatusInfoChangedEvent] - 'miio:vacuum:mimi' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to UNINITIALIZED (HANDLER_CONFIGURATION_PENDING)
2020-06-07 16:33:19.522 [vent.ItemStateChangedEvent] - health_heinzelmann changed from INITIALIZING to OFFLINE
2020-06-07 16:33:19.541 [hingStatusInfoChangedEvent] - 'miio:vacuum:heinzelmann' changed from OFFLINE to ONLINE
2020-06-07 16:33:19.547 [vent.ItemStateChangedEvent] - health_heinzelmann changed from OFFLINE to ONLINE

things file:

Thing miio:vacuum:heinzelmann	"Rockrobo S5 Heinzelmann" [ 
	host="10.36.38.130",
	deviceId="132DE7BA",
	token="54456B69XXXXXXXXXXXXXXXX54713439",
	model="roborock.vacuum.s5e"
]

Thing miio:vacuum:momo		"Xiaomi Mi Robot v1 MoMo" [
	host="10.36.38.129",
	devideId="04EB89B0",
	token="62484dXXXXXXXXXXXXXXXXXX5a793844",
	model="rockrobo.vacuum.v1"
]


Thing miio:vacuum:mimi		"Xiaomi Mi Robot v1 MiMi" [
	host="10.36.38.128",
	devideId="046EC36B",
	token="41374XXXXXXXXXXXXXXXXXXX6752554a",
	model="rockrobo.vacuum.v1"
]

As I said, the tokens and deviceIds are exact the same as reported in the log / in the json/file (in /var/lib/openhab).

I don’t see any difference except in robot model.

Any hint on what I may be missing?

Regards
Thomas

Hi,

I solved my Problem. I noticed that in Paper UI, the Device ID is missing (I checked that, after I read here: https://www.openhab.org/docs/concepts/things.html that HANDLER_CONFIGURATION_PENDING means that some property is missing to initialize the thing).

After staring at everything over and over again for, as it seems, hours - I noticed that I head a typo in my configuration (see above: “devideId” instead of “deviceId”) - corrected that and the bots came online immediately.

He who can read has the advantage.

Regards,
Thomas

1 Like

It can be highly difficult to read own typos :smiley:

sorry i am not into coding myself so i will kindly wait for the official implemention of this feature…

Indeed. Happens more often than it should… :grin:

Hello,
got my new Roborock S6 last week, when trying to integrate it into openHAB I was already having problems within the first step: after installing Roborock app on my android device with roborock account I learned that Roborock app is not supported but “Mi Home app” - i seem too stupid to find “Mi Home app” within the google play store.
To use also Amazon’s Alexa for the S6 control I installed ”Roborock Plus” Alexa skill, its description told me that three different apps are available to control a Roborock: Roborock app, Xiaomi Home app and MiHome app (by the way - only the first one supports the “Roborock Plus” Alexa skill). As you can see the first two apps I found in the google play store but not the correct MiHome app (this MI-HOME app of 2013 seems to be the wrong one).

Can anybody help?

Regards,
Andy

The second link is the regular app for the vacuum.
If you use that one it will be found by openhab

@marcel_verpaalen Thank you for this tip, Marcel - and for this great binding.
Regards,
Andy

Thank you for this awesome binding, had it up and running within an hour, including the script posted by @tbrettinger. One question, how can I reset the map? I tried deleting the map in the user_data/mio folder, I restarted the bundle and I see in the logs that its retrieving a new map, but in my basic UI is still showing the old one (with only 2 rooms instead of the 4 I have configured later)

Edit: One other question, is it possible to control the mop?

Hi Matthias,
I’m pretty new to openhab, I’ve seen you’ve managed to import yor S5 Max. How did you get the Token and the parameters for the binding?

My state:

  • Clean installation (via docker on my home-NAS) of openhab v2.5.5
  • Mobilephone: installed “Xiaomi Home” app
  • Created an account and added my Roborock (was using Roborock app before)
  • Installed “Xiaomi Mi IO Binding” by Marcel Verpaalen (thank you for your work!)
  • Entered my Credentials for the account, (filling server with “de” or leaving blank)

When I try to add a “thing” via the binding nothing is found.
Am I missing something?

Oh damn! I got it!
It was the docker container missconfiguration, It clearly says:
" Important: To be able to use UPnP for discovery the container needs to be started with --net=host ."
After I did this the S5 Max was found!

1 Like

@marcel_verpaalen

I have tried including devices from cloud without luck.
Maybe I was not specific enough this is an already created Thing and I don’t want to remove it.
I have changed the IP address, removed the token (though it showed that field is required), but nothing happened after. Tried doing a discovery, but no success.
Can I somehow retrieve tokens for already created Things also?

Sorry I just saw your response now.
It seems that this is correct, and it shows the tokens…
But updating the token manually I get “No response from device”.

Ps.: I just changed network (seperate IoT network), but the main network has full access to that IoT network and I can ping the device (it really seems that the token is wrong).
Does the deviceId changes also when the inclusion is done again? If yes, where I can find this ID?

I have extracted the token from the backup and I got the same token so it might be right.
The air purifier is in a different vlan now, but for testing and debugging everything can be accessed from the IoT VLAN now, so unicast traffic should work vice-versa now, still the log says “Ping unsuccessful” and “No response from device”…
It is not a big problem for me if discovery is not working (looking at the code, multicast addresses are used) but I hope that if you enter the details manually it works unicast

Can someone help me on this, mainly who use seperate VLAN for IoT devices?
Thanks!

2020-06-16 21:44:37.619 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Communication error for Mi device at 10.0.1.12: Receive timed out

2020-06-16 21:44:37.621 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 03C5297B (10.0.1.12) failed

2020-06-16 21:44:37.624 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Finished Mi IO MessageSenderThread

2020-06-16 21:44:37.623 [DEBUG] [internal.handler.MiIoAbstractHandler] - Ping response from device 03C5297B at 10.0.1.12 FAILED

2020-06-16 21:44:37.634 [DEBUG] [internal.handler.MiIoAbstractHandler] - Ping Mi device 03C5297B at 10.0.1.12

2020-06-16 21:44:37.637 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Starting Mi IO MessageSenderThread

2020-06-16 21:44:37.637 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 03C5297B (10.0.1.12)

I forgot that I already migrated my xiaomi robot (which is a rooted one), but for that changing the IP and the token worked, I don’t know why it does not work here…
Any idea why it could show these timeouts and never connect to the device?

I also discovered that “did” is the deviceId as I assumed but in decimal, not hex. Converting that also to hex, I get the same results. So I really don’t know what is wrong here…