Xiaomi Robot Vacuum Binding

i got the first command!

ill do a list later, for now sending

set_mode_withroom [0, 1, 0]

will start the vacuum

I added my Roborock s50 to OH2.5
It went online and then a minute later to OFFLINE. The fact that it has been online i guess shows that the settings are ok.

Any idea what is going wrong ?

2019-12-19 10:44:24.757 [hingStatusInfoChangedEvent] - 'miio:vacuum:0F85F601' changed from UNINITIALIZED to INITIALIZING
2019-12-19 10:44:24.779 [hingStatusInfoChangedEvent] - 'miio:vacuum:0F85F601' changed from INITIALIZING to OFFLINE
2019-12-19 10:44:34.803 [hingStatusInfoChangedEvent] - 'miio:vacuum:0F85F601' changed from OFFLINE to ONLINE
2019-12-19 10:45:34.930 [hingStatusInfoChangedEvent] - 'miio:vacuum:0F85F601' changed from ONLINE to OFFLINE (CONFIGURATION_ERROR)

i added the binding through addons.cfg and the think and items through PaperUI

You need to be more specific…
Did you add the token as well?
I believe you can experience to see a thing going online, and a few minutes after it turns to offline due to configuration issues. I have seen this before.

In case you´re absolutly sure there is no config error, then perhaps try restart openhab and/or try clear the cache/tmp. Sometimes these “things” simply mess up, and a clear cache/tmp as well as restart is needed to correct it.

I have my Roborock S55 online, and it´s working great.

I checked the token again with the altered Mi Home app … and the last 3 digits of the token had changed … with the new token it now works! But when does it change ? Each time i start the app?

No, the token should ONLY change, when the Wifi setting of the Roborock changes. (Ie if you reset the configuration of the Roborock and add it to your WiFi network again, it will create a new token).
Its weird that yours are changing… How is your WiFi network set up?

No, that’s not right. I have the new Roborock Vacuum S5 Max (s5e) and the fan mode is as follows (data “fan_power” via the “get_status” command):

101=Silent
102=Balanced
103=Turbo
104=Max
105=Gentle
106=Customize (Auto)

I marked this on the image in the Xiaomi app settings:

However, the customize switch is only active when the mop mode has been also set correctly.
For the mop mode I would create a feature request in Github.

Because the fan values of the newer models are over 100, I think the format is no longer correct:

I think you are right in that respect.

Also we would need to add 106 to the mapping table. I see 105=gentle in your table, but we had it as mob in the table before. What is the value when you set the various mob levels? does it go beyond 106? Or are all the modes >100 mob modes?

101 to 106 are only values for fan power. Also the value 105 has no use for the mob, it is also a value for the fan.

The mob values start at 200, I have created a feature request for this. See here:

https://github.com/openhab/openhab2-addons/issues/6628

Let’s have that checked by someone that owns a regular S5 /S50.
Might be that it depends on the device.

@marcel_verpaalen do you have an idea how I could find out the method of adjusting the water flow? With get_status I get the values 200 to 205 for water_box_mode. But so far I have not been able to figure out how to set the values.

I just removed my complete userdata folder and started from scratch, but still have the same error.
When i downgrade to 2.4, it is working again, so the token shouldn’t be the problem, right?

here a trace log after restarting the binding:

2019-12-19 20:40:45.194 [DEBUG] [internal.handler.MiIoAbstractHandler] - Disposing Xiaomi Mi IO handler 'miio:vacuum:117978615'
2019-12-19 20:40:45.204 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Receiver thread received SocketException: Socket closed
2019-12-19 20:40:45.205 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Receiver thread ended
2019-12-19 20:40:45.207 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Stop Xiaomi  Mi IO background discovery
2019-12-19 20:40:45.232 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Start Xiaomi Mi IO background discovery
2019-12-19 20:40:45.239 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Getting new socket for discovery
2019-12-19 20:40:45.241 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 172.17.255.255 from 0.0.0.0/0.0.0.0:46016
2019-12-19 20:40:45.243 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 224.0.0.50 from 0.0.0.0/0.0.0.0:46016
2019-12-19 20:40:45.244 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 172.18.255.255 from 0.0.0.0/0.0.0.0:46016
2019-12-19 20:40:45.244 [TRACE] [l.discovery.MiIoDiscoveryParticipant] - ServiceInfo: [ServiceInfoImpl@32563131 name: 'roborock-vacuum-s5_miio117978615._miio._udp.local.' address: '(null):54321' status: 'NO DNS state: probing 1 task: null', has NO data, empty]
2019-12-19 20:40:45.246 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 172.19.255.255 from 0.0.0.0/0.0.0.0:46016
2019-12-19 20:40:45.247 [DEBUG] [l.discovery.MiIoDiscoveryParticipant] - mDNS roborock-vacuum-s5 identified as thingtype miio:vacuum with did 070835F7 (117978615)
2019-12-19 20:40:45.249 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 224.0.0.1 from 0.0.0.0/0.0.0.0:46016
2019-12-19 20:40:45.250 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Starting discovery receiver thread for socket on port 46016
2019-12-19 20:40:45.252 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 192.168.4.255 from 0.0.0.0/0.0.0.0:46016
2019-12-19 20:40:45.254 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Thread Thread[Thread-152,5,main] waiting for data on port 46016
2019-12-19 20:40:45.258 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Received 32 bytes response from 192.168.4.110:54321 on Port 46016
2019-12-19 20:40:45.259 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery response received from 192.168.4.110 DeviceID: 070835F7
Message:
Header  : 21 31 00 20 00 00 00 00 07 08 35 F7 5D FB D2 3C
checksum: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
content : N/A
Header Details: Magic:21 31
Length:   32
Serial:   07 08 35 F7
TS:2019-12-19 20:40:44
2019-12-19 20:40:45.261 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery responses from : 192.168.4.110:21 31 00 20 00 00 00 00 07 08 35 F7 5D FB D2 3C FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
2019-12-19 20:40:45.262 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Discovered Mi Device 070835F7 (117978615) at 192.168.4.110 as miio:generic:070835F7
2019-12-19 20:40:45.264 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - No token discovered for device 070835F7. For options how to get the token, check the binding readme.
2019-12-19 20:40:45.270 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Thread Thread[Thread-152,5,main] waiting for data on port 46016
2019-12-19 20:40:45.271 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Received 32 bytes response from 192.168.4.110:54321 on Port 46016
2019-12-19 20:40:45.278 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery response received from 192.168.4.110 DeviceID: 070835F7
Message:
Header  : 21 31 00 20 00 00 00 00 07 08 35 F7 5D FB D2 3C
checksum: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
content : N/A
Header Details: Magic:21 31
Length:   32
Serial:   07 08 35 F7
TS:2019-12-19 20:40:44
2019-12-19 20:40:45.280 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Thread Thread[Thread-152,5,main] waiting for data on port 46016

and this is my thing-config:

Thing miio:vacuum:117978615 "Bobbi" @ "Wohnzimmer" [ host="192.168.4.110", token="XXXXXXXXXXXXXXXX" ]

The log says:

2019-12-19 20:40:45.264 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - No token discovered for device 070835F7. For options how to get the token, check the binding readme.

As I said, the same config works with openHAB 2.4 and the token is also working there

@marbon87
You miss the (mandatory) modelid in the text config, this should result in handler config error.
Maybe 2.5 is more strict in checking and not initiating the handler. But in 2.4 you will most likely have problems with the device stopping after a while

got most of the commands up and running for viomi-vacuum-v7, I still need to figure out how to change the water level used by the vacuum, but most of them are already there.

@merccooper if that is all, you can make a basic device database entry to (almost fully) support it.
Only the get_disturb would be trickey

Look at the existing database files, gives you direction on how to do. All the things you find in the get_prop section should have a corresponding property in the database.
The actions are to send the set_… commands

sorry, but could you be more precise?
do you mean that thing config shold look like this:

Thing miio:vacuum:070835F7 "Bobbi" @ "Wohnzimmer" [ host="192.168.4.110", token="XXXXXXXXX" ]

I already tried that and have the same problem, but other error

2019-12-20 10:18:27.600 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Receiver thread received SocketException: Socket closed
2019-12-20 10:18:27.600 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Stop Xiaomi  Mi IO background discovery
2019-12-20 10:18:27.601 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Receiver thread ended
2019-12-20 10:18:27.693 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Start Xiaomi Mi IO background discovery
2019-12-20 10:18:27.698 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Getting new socket for discovery
2019-12-20 10:18:27.699 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Starting discovery receiver thread for socket on port 48427
2019-12-20 10:18:27.699 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 172.17.255.255 from 0.0.0.0/0.0.0.0:48427
2019-12-20 10:18:27.700 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Thread Thread[Thread-393,5,main] waiting for data on port 48427
2019-12-20 10:18:27.702 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 224.0.0.50 from 0.0.0.0/0.0.0.0:48427
2019-12-20 10:18:27.703 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 172.18.255.255 from 0.0.0.0/0.0.0.0:48427
2019-12-20 10:18:27.705 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 172.19.255.255 from 0.0.0.0/0.0.0.0:48427
2019-12-20 10:18:27.707 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 224.0.0.1 from 0.0.0.0/0.0.0.0:48427
2019-12-20 10:18:27.708 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery sending ping to 192.168.4.255 from 0.0.0.0/0.0.0.0:48427
2019-12-20 10:18:27.711 [TRACE] [l.discovery.MiIoDiscoveryParticipant] - ServiceInfo: [ServiceInfoImpl@17026561 name: 'roborock-vacuum-s5_miio117978615._miio._udp.local.' address: '(null):54321' status: 'NO DNS state: probing 1 task: null', has NO data, empty]
2019-12-20 10:18:27.712 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Received 32 bytes response from 192.168.4.110:54321 on Port 48427
2019-12-20 10:18:27.714 [DEBUG] [l.discovery.MiIoDiscoveryParticipant] - mDNS roborock-vacuum-s5 identified as thingtype miio:vacuum with did 070835F7 (117978615)
2019-12-20 10:18:27.714 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery response received from 192.168.4.110 DeviceID: 070835F7
Message:
Header  : 21 31 00 20 00 00 00 00 07 08 35 F7 5D FC 91 E3
checksum: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
content : N/A
Header Details: Magic:21 31
Length:   32
Serial:   07 08 35 F7
TS:2019-12-20 10:18:27
2019-12-20 10:18:27.715 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Thread Thread[Thread-393,5,main] waiting for data on port 48427
2019-12-20 10:18:27.715 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery responses from : 192.168.4.110:21 31 00 20 00 00 00 00 07 08 35 F7 5D FC 91 E3 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
2019-12-20 10:18:27.716 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Discovered Mi Device 070835F7 (117978615) at 192.168.4.110 as miio:generic:070835F7
2019-12-20 10:18:27.716 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Received 32 bytes response from 192.168.4.110:54321 on Port 48427
2019-12-20 10:18:27.718 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Discovery response received from 192.168.4.110 DeviceID: 070835F7
Message:
Header  : 21 31 00 20 00 00 00 00 07 08 35 F7 5D FC 91 E3
checksum: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
content : N/A
Header Details: Magic:21 31
Length:   32
Serial:   07 08 35 F7
TS:2019-12-20 10:18:27
2019-12-20 10:18:27.718 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - No token discovered for device 070835F7. For options how to get the token, check the binding readme.
2019-12-20 10:18:27.719 [TRACE] [iio.internal.discovery.MiIoDiscovery] - Thread Thread[Thread-393,5,main] waiting for data on port 48427

It is so easy to set this up with autodiscovery. :sunglasses:

You do it as per the binding readme incl the model &deviceId:

Thing miio:vacuum:070835F7 "Bobbi" @ "Wohnzimmer" [ host="192.168.4.110", token="put here your token", deviceId="0326xxxx" ,model="rockrobo.vacuum.v1"]
 ]

If this helps, then I have this:

Thing miio:vacuum:s50 "vacuum" @ "vacuum" [ host="192.168.215.20", token="xxxxxxx", deviceId="0470DD46", model="roborock.vacuum.s5" ]
1 Like