Xiaomi Robot Vacuum Binding

You need to put a setting to allow for beta software in the market place settings. I had same issue, after setting this it appears.

Verstuurd vanaf mijn iPad

It is the first in your list. Mi IO binding.
I renamed it once it supported other devices as well

Mmm, I don’t think there is a conflict. It is an unexpected side effect of the additional logging I added for my mi device emulator development.

I’ll remove it with the next update so it won’t clog your log

1 Like

Hi Marcel,
absolut great work, thank you so much! Works like a charm :slight_smile:
Best regards from germany,
Michael

I have a xiaomi original WIFI smart plug - it has been detected as a basic device

image

however a couple of questions:
How do I find out the device model string as there is only a command channel at the moment.

If this is the only option - what do I send it to just do a on or off?

@Andrew_Pawelski
When you enter a valid token, the model will be populated automatically. No need to manually put in anything. I assume the switch you currently see also does not function, correct? (If it does, and the model is not populating, pls send me a full log, from the start of the binding until approx 2min after)

From the lengthy key, am I correct to assume it is a key extracted from ios? If yes, please check if you see a ‘could not decrypt key’ in the log, as that would explain the issue

btw. For your plug, better post your questions in this thread.

@marcel_verpaalen is the information from above post sufficient?
let me know when I can provide morr

Hi @shorty707

Yes, I’ll need to develop the mechanism to do the calculations, but that is clear.
Can you tell me what are the exact strings you send for the various modes. I’m not sure I have them all

Can you pls indicate your exact model + fw, as I had the filter stuff in an earlier version, but than few did get null responses. (each version seems to have different subset of commands, maybe even firmware related)

Can you feedback the responses you get from the following commands
get_prop["led_b","buzzer","child_lock","limit_hum","trans_level"]
get_prop["battery","usb_state"]

20:53:00.776 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":14250,"method":"get_prop","params":["led_b","buzzer","child_lock","limit_hum","trans_level"]} -> 192.168.1.73 (Device: 035CAFE2 token: 92CB177775A1B10982EA2A71DC23F26D Queue: 1)
20:53:00.811 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Locating action for channel actions#commands:get_prop["led_b","buzzer","child_lock","limit_hum","trans_level"]
20:53:00.818 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Channel Id actions#commands not in mapping. Available:
20:53:00.825 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: mode : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@12c4e6c
20:53:00.833 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: buzzer : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@113ce11
20:53:00.840 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: led : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@114457
20:53:00.847 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: power : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@272519
20:53:00.866 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_commandchannel changed from NULL to get_prop["led_b","buzzer","child_lock","limit_hum","trans_level"]
20:53:00.878 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 035CAFE2 type: GET_PROPERTY, result: [2,"off","off",null,null], fullresponse: {"result":[2,"off","off",null,null],"id":14250}
20:53:00.897 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_commandchannel changed from get_prop["led_b","buzzer","child_lock","limit_hum","trans_level"] to {"result":[2,"off","off",null,null],"id":14250}
20:53:00.905 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Channel not found for led_b
20:53:00.924 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Channel not found for child_lock
20:53:00.927 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Property 'limit_hum' returned null (is it supported?).
20:53:00.930 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Property 'trans_level' returned null (is it supported?).
20:53:12.095 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Periodic update for 'miio:basic:035CAFE2' (miio:basic)
20:53:12.124 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":14251,"method":"get_prop","params":["power","mode","humidity","aqi","led"]} -> 192.168.1.73 (Device: 035CAFE2 token: 92CB177775A1B10982EA2A71DC23F26D Queue: 1)
20:53:12.151 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":14252,"method":"get_prop","params":["buzzer","f1_hour","temp_dec"]} -> 192.168.1.73 (Device: 035CAFE2 token: 92CB177775A1B10982EA2A71DC23F26D Queue: 2)
20:53:12.244 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 035CAFE2 type: GET_PROPERTY, result: ["on","auto",69,10,"off"], fullresponse: {"result":["on","auto",69,10,"off"],"id":14251}
20:53:12.283 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 035CAFE2 type: GET_PROPERTY, result: ["off",3500,218], fullresponse: {"result":["off",3500,218],"id":14252}
20:53:12.308 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_tempC changed from 217 to 218
20:53:15.069 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'XAIR_commandchannel' received command get_prop["battery","usb_state"]
20:53:15.080 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":14253,"method":"get_prop","params":["battery","usb_state"]} -> 192.168.1.73 (Device: 035CAFE2 token: 92CB177775A1B10982EA2A71DC23F26D Queue: 1)
20:53:15.131 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Locating action for channel actions#commands:get_prop["battery","usb_state"]
20:53:15.142 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Channel Id actions#commands not in mapping. Available:
20:53:15.154 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: mode : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@12c4e6c
20:53:15.129 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 035CAFE2 type: GET_PROPERTY, result: [null,null], fullresponse: {"result":[null,null],"id":14253}
20:53:15.169 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Property 'battery' returned null (is it supported?).
20:53:15.158 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: buzzer : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@113ce11
20:53:15.182 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: led : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@114457
20:53:15.188 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Property 'usb_state' returned null (is it supported?).
20:53:15.201 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_commandchannel changed from {"result":[2,"off","off",null,null],"id":14250} to {"result":[null,null],"id":14253}
20:53:15.185 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: power : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@272519
20:53:15.229 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_commandchannel changed from {"result":[null,null],"id":14253} to get_prop["battery","usb_state"]

image

here are more working properties. would be nice to add them:

21:03:57.094 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_commandchannel changed from get_prop["battery","usb_state"] to get_prop["filter1_life"]
21:03:57.118 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Channel not found for filter1_life
21:03:57.133 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_commandchannel changed from get_prop["filter1_life"] to {"result":[90],"id":14296}

21:12:48.404 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":14335,"method":"get_prop","params":["favorite_level"]} -> 192.168.1.73 (Device: 035CAFE2 token: 92CB177775A1B10982EA2A71DC23F26D Queue: 1)
21:12:48.431 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Locating action for channel actions#commands:get_prop["favorite_level"]
21:12:48.442 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Channel Id actions#commands not in mapping. Available:
21:12:48.452 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: mode : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@12c4e6c
21:12:48.463 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: buzzer : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@113ce11
21:12:48.475 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: led : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@114457
21:12:48.483 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: power : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@272519
21:12:48.497 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 035CAFE2 type: GET_PROPERTY, result: [10], fullresponse: {"result":[10],"id":14335}
21:12:48.523 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Channel not found for favorite_level
21:12:48.527 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_commandchannel changed from get_prop["favorite_level"] to {"result":[10],"id":14335}
21:12:48.525 [INFO ] [marthome.event.ItemStateChangedEvent] - XAIR_commandchannel changed from {"result":[null],"id":14328} to get_prop["favorite_level"]


21:15:39.256 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":14348,"method":"get_prop","params":["f1_hour_used","use_time","motor1_speed"]} -> 192.168.1.73 (Device: 035CAFE2 token: 92CB177775A1B10982EA2A71DC23F26D Queue: 1)
21:15:39.293 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Locating action for channel actions#commands:get_prop["f1_hour_used","use_time","motor1_speed"]
21:15:39.298 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Channel Id actions#commands not in mapping. Available:
21:15:39.302 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: mode : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@12c4e6c
21:15:39.306 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: buzzer : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@113ce11
21:15:39.311 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: led : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@114457
21:15:39.315 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - entries: power : org.openhab.binding.miio.internal.basic.MiIoDeviceAction@272519
21:15:39.344 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 035CAFE2 type: GET_PROPERTY, result: [327,1179900,349], fullresponse: {"result":[327,1179900,349],"id":14348}

to explain them a little I checked vs the app:

filter1_life -> remaining life time of the filter PERCENT -> in my case 90%

favorite_level -> is a user defined value ; most possibly between 1-11 (is same as in the app); after setting this value the command “favorite” in mode channel sets the purifier to this

f1_hour_used -> return value is hours of usage time of the filter

use_time -> divided by 3600 equals the return value of f1_hour_used; however maybe this value keeps counting after f1_hour_used was reset when replacing filters --> not sure --> but value divided by 3600 should be considered for the binding… seconds are hard to read :wink:

motor_speed -> not sure whats the unit there … probably RPM ?

I have the AIR PURIFIER 2. The PRO Version has different channels.
here you can see the difference:

https://pypkg.com/pypi/python-mirobo/f/mirobo/airpurifier.py

I’ve added the channels for the AIR PURIFIER 2. (zhimi.airpurifier.m1)
Should be available in market place in about 20 min.
Note, the conversions are not implemented yet, just the raw data

@Andrew_Pawelski
With help of @chrode found issue in the IOS token decryption. Pls update to the latest version from marketplace (available now) to have the binding decode your IOS token.

Hi! Just wanted to let you know, that I updated the binding to the newest version tonight and now it works. Perfect! Thank you so much for your Effort!!!

all added channels work…
some comments…

  • miio:basic:035CAFE2:filterusedhours → in raw data this is seconds currently; it reports the same value for a longer time… and internally seems to be updated in periodic cycles when division by 3600 is ,25 ,5 ,75 or a full decimal…
    however in my case the value matches neither the run time of the device, of the filter or anything… so not sure what it actually is

  • miio:basic:035CAFE2:filtermaxlive → still a little typo here → maxliFe

the most relevant I added quick and dirty:

THANKS !!! :slight_smile:

update to this channel again… it seems to be the RUN TIME of the device itself in seconds…
I was confused before because the iOS version says something different… see below the screenshots of
iOS compared to ANdroid; (iOS needs to fully stop and restart the app to pull the correct value)

→ Run Time vs Working Time
→ air purified (seems to be runtime * 37; ignoring any fan speed setting :wink: )

:smiley::smiley::smiley: haha

sorry … another thing I stumbled over…

miio:basic:035CAFE2:favoritelevel … is that read only? when I set it to a another level in the UI it reads back to level set via the official app in the next periodic cycle

With new version of MiToolkit 1.5, I successfully discovered the vacuum token key. Previous versions are not worked for me.

@marcel_verpaalen: Thanks for your work. Finally I could controll my Xiaomi Vacuum too, next to Air Purifier 2 :slight_smile: Great work!

Great to hear that my tool is helpful. Have done some work with various versions of adb.exe in 1.5 to cover as many different Android devices/versions as possible.

1 Like

Did you my any chance make an English version?

Thank you @ultrara1n :slight_smile:

In version 1.5, you can change the language to English :slight_smile:

1 Like
21:15:39.342 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Periodic update for 'miio:basic:03197AFA' (miio:basic)
21:15:39.346 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Building Channel Structure for miio:basic:03197AFA - Model: zhimi.airpurifier.v6
21:15:39.347 [WARN ] [inding.miio.handler.MiIoBasicHandler] - Database entry for model 'zhimi.airpurifier.v6' cannot be found.
21:16:09.347 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Periodic update for 'miio:basic:03197AFA' (miio:basic)
21:16:09.350 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Building Channel Structure for miio:basic:03197AFA - Model: zhimi.airpurifier.v6
21:16:09.350 [WARN ] [inding.miio.handler.MiIoBasicHandler] - Database entry for model 'zhimi.airpurifier.v6' cannot be found.

When I click in any miio thing, I got an Error: 404 - NOT FOUND. Any Idea what happen?