Xiaomi Robot Vacuum Binding

ok. Problem is the token. I extracted the token from the cleaner before connecting to the app. Now I learned token will be changed when connecting to an app.

I also tried to exctract the token via ios app. The 96 char token i received lead to the log entry

Could not decrypt token xxxx

Using MiToolkit for extracting the token from android does not work for me, because MiToolkit is crashing. Is there another way for extracting the token from the backup.

Thanks,
Jörg

@marcel_verpaalen Again thank you very much for your support and for developing the binding. I got it running now. It was a the wrong token.

I extracted the correct token from an android phone. Nevertheless the key extracted from iOS the binding has problems decrypting the token (something todo with iOS oder the app version??)

Jörg

@joerg_ramser I indeed think that is the issue.

If you PM me your IOS token I’ll try if I can decrypt it.
To get your token: if you read through the thread, you see the ‘manual’ / screenshots way of extracting your token (unpacking your backup, opening the (right) database, open the table with the devices, read the token column)

@shorty707

Looks like it is 10x as big indeed, correct?

Currently I don’t do any calculations, just give whatever the output from the device is.
Can you send me the request & response to the ‘get_prop’ command. See if somehow the value is getting wrongly interpreted.

correct - in the above screenshot it should be 22,5 C; in the below one 22,1 C

is the periodic ok?

08:08:10.260 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Periodic update for 'miio:basic:035CAFE2' (miio:basic)
08:08:10.379 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":5464,"method":"get_prop","params":["power","mode","humidity","aqi","led"]} -> 192.168.1.73 (Device: 035CAFE2 token: 92CB1EE585A1B10EA2A71DC23F26D Queue: 1)
08:08:10.434 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":5465,"method":"get_prop","params":["buzzer","f1_hour","temp_dec"]} -> 192.168.1.73 (Device: 035CAFE2 token: 92CB1EE585A1B10EA2A71DC23F26D Queue: 1)
08:08:10.453 [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":5464}
08:08:10.767 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 035CAFE2 type: GET_PROPERTY, result: ["off",3500,222], fullresponse: {"result":["off",3500,222],"id":5465}

additonally I can say:

  • the channel “filtermaxlive” should be “filtermaxlife”; however this is a static value of 3500 hours which is the initial lifetime of the filter and useless since it is static

  • other channels for “remaining life time” of the filter would be more interesting

  • the channel for the Power Switch is working; however also the MODE channel has a mode to set “idle” which is the same as OFF and therefore I just use the mode channel

I upgraded to the latest version yesterday and it seems to work atm :slight_smile: Thank you so much

I could now extract the token from an android phone. Everything now works fine. Thank you very much for your support.

Jörg

Hi I think the xiaomi mi IO binding might conflict with my chromcasts units. I don’t know if it was the binding but my pi crashed yesterday night and I had alot of these in the log file:

2017-10-02 21:31:40.495 [WARN ] [l.discovery.MiIoDiscoveryParticipant] - mDNS Could not identify Type / Device Id from 'Chromecast-Audio-66c695bbdbd0a8cbcef903f1847a34db'
2017-10-02 21:31:40.503 [WARN ] [l.discovery.MiIoDiscoveryParticipant] - mDNS Could not identify Type / Device Id from 'Google-Cast-Group-0ad558bfbc7a4007ae4c83b42d896239-1'
==> /var/log/openhab2/events.log <==
2017-10-02 21:31:41.198 [ItemStateChangedEvent     ] - CC_all_audioGroup_control changed from PAUSE to PLAY
==> /var/log/openhab2/openhab.log <==
2017-10-02 21:31:42.574 [WARN ] [l.discovery.MiIoDiscoveryParticipant] - mDNS Could not identify Type / Device Id from 'Chromecast-Audio-66c695bbdbd0a8cbcef903f1847a34db'
2017-10-02 21:31:42.597 [WARN ] [l.discovery.MiIoDiscoveryParticipant] - mDNS Could not identify Type / Device Id from 'Google-Cast-Group-0ad558bfbc7a4007ae4c83b42d896239-1'
2017-10-02 21:31:43.509 [WARN ] [l.discovery.MiIoDiscoveryParticipant] - mDNS Could not identify Type / Device Id from 'Chromecast-Audio-2f017b590f185ac3e223abd0f7fb2109'
2017-10-02 21:31:43.522 [WARN ] [l.discovery.MiIoDiscoveryParticipant] - mDNS Could not identify Type / Device Id from 'Chromecast-Audio-61b92aca71262914247b5acf4e2e2a40'

might by true. I also have these lately.

@marcel_verpaalen, I just received my vacuum cleaner and am eager to install your binding. But unfortunately I cannot find it in the bindings list. Do you have any idea, what I’m doing wrong?

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