Xiaomi Mi Air Purifier (Xiaomi Mi IO)

Some update - HAPanel appears after clearance the cache

1 Like

@Mikhail I forget to say, that you need to uninstall Xiaomi Mi IO Binding thru Paper UI before putting .jar to addons folder. You don’t need to do anything else.

1 Like

Hey guys,
could anybody help me with my 2S? Tried generating new tokens but it’s still the same :confused:

Thanks!

Is there any way to add zhimi.airpurifier.mc2 (2H) or edit the ones already added so I can pull the filter data out? It only has power and experimental commands as an unsupported device. It should be the same as 2S minus the display.

Hi Denzel,
Pls read https://www.openhab.org/addons/bindings/miio/#thing-configuration

First remove your current device, and (manually) add it back as a miio:basic device and override the model with the details of the 2S. Than you can see if that responds back the values you are looking for. If the required channels are not available you may try other models. to see if that has the

Hi Alex,

tried the jar on my zhimi.airpurifier.mb3 but nothing changed… I see just a “Life” parameter read from the device (a 5 digit number).

His changes are also already in the regular/latest official binding.

The current official binding also now allows you to easily try new database for as you can have them locally on your oh install (no need for jar to add a new device)

In your case, suggest to share the debug log so we can understand the device responses better and advice a solution.

OK, I removed the device, turned on logging and then re-discovered. Also tried an “on/off” command after I added the token.

Thanks

Your device is indeed using a different protocol than the binding is currently supporting. It is so called "miot’ instead of miio.

You can try the following send this to the command channel and see if it is responding to it. (replace the MYDID with your deviceID … you may need to fiddle bit to get the correct string to be send (the #OFF /#ON) are not to be send…

set_properties [{"did":"MYDID","piid":2,"siid":2,"value":true}] #ON
set_properties [{"did":"MYDID","piid":2,"siid":2,"value":false}] #OFF

and e.g.
get_properties [{"did":"MYDID","siid": 3, "piid": 6}]

Don’t exactly know what is expected as myID 1823426819 10212739 or 270608185 (I expect the last one)
Let me know your results, maybe I can make some changes so we can support these miot devices in the future.

Otherwise, you may be able to log some of the communication with the vevs version of the mihome app (as mentioned in one of the above topics). Or python-miio today added support for your device… try there with debug on and see what it is sending… we can always send the same with the command channel

it appears python-miio is sending the command like this… (instead of the device id the property)
So you may want to give that command a try as well.
Note, these commands are to be send to the command channel for your device in openhab (use show more in paperUI to see that channel and enable it)

get_properties[{"did": "power", "siid": 2, "piid": 2}, {"did": "fan_level", "siid": 2, "piid": 4}, {"did": "mode", "siid": 2, "piid": 5}, {"did": "humidity", "siid": 3, "piid": 7}, {"did": "temperature", "siid": 3, "piid": 8}, {"did": "aqi", "siid": 3, "piid": 6}, {"did": "filter_life_remaining", "siid": 4, "piid": 3}, {"did": "filter_hours_used", "siid": 4, "piid": 5}, {"did": "buzzer", "siid": 5, "piid": 1}, {"did": "buzzer_volume", "siid": 5, "piid": 2}, {"did": "led_brightness", "siid": 6, "piid": 1}, {"did": "led", "siid": 6, "piid": 6}, {"did": "child_lock", "siid": 7, "piid": 1}, {"did": "favorite_level", "siid": 10, "piid": 10}, {"did": "favorite_rpm", "siid": 10, "piid": 7}]

So, I tried the first set and it seemed to work.
It turned the appliance ON and OFF (using the last myID, indeed).
On the get command I received the following (this is the log entry):

miio_generic_10212739_actions_commands changed from get_properties [{“did”:“270608185”,“siid”: 3, “piid”: 6}] to {“id”:17,“result”:[{“did”:“270608185”,“siid”:3,“piid”:6,“code”:0,“value”:9}]}

The “value”: 9 seems to match the PM2.5 value.
For piid 7 I seem to get the value of humidity.
For piid 8 I got the temperature (Celsius).

The long get properties command doesn’t seem to work as such. I got a malformed command or something. Was I supposed to replace something in it?

So, the first set of commands seem to lead to some results.

Thanks

cool. Can you try one of the single get commands but putting something else in the did section
Just to understand if it is the long list of gets that is causing the issue or if it is the did part

Funny, it seems it doesn’t matter. I tried other IDs and it still returned the value. Here are two log entries:

miio_generic_10212739_actions_commands changed from get_properties [{“did”:“207608000”,“siid”: 3, “piid”: 6}] to {“id”:591,“result”:[{“did”:“207608000”,“siid”:3,“piid”:6,“code”:0,“value”:19}]}

miio_generic_10212739_actions_commands changed from get_properties [{“did”:“000000”,“siid”: 3, “piid”: 6}] to {“id”:593,“result”:[{“did”:“000000”,“siid”:3,“piid”:6,“code”:0,“value”:21}]}

It even worked with the text you sent (“get_properties [{“did”:“MYDID”,“siid”: 3, “piid”: 6}]”)

I was expecting this a bit looking at the code in python miio. I first thought it was a bug, but they use it to more conveniently recognize the parameter.

I added miot support (your device) to my wishlist. (that is not any promise that support will be there anytime soon :slight_smile: ) Suggest for now to create rules for the most relevant commands so you can control your device

Thanks a lot for your efforts!
I guess this protocol will be used going forward…
If you need any more help troubleshooting or testing, let me know.

Hi Ivan, I faced a same problem like you. Have you ever had any solution for this issue?

I did a hackish attempt to add support for miot devices try alpha version , download here
To be installed in the addons folder see openHAB on Linux | openHAB

I think the command sending probably works as well as properties sending. I have not been able to test the properties receiving (I don’t have such a device)

I only added few channels… if it somewhat works, you may want to put below file to your conf/misc/miio folder and edit it to add more channels

zhimi.airpurifier.mb3miot.json (2.4 KB)

Unfortunately it’s not working. I put the jar in openhab2-addons and the json in the conf/misc/miio folders (created miio)
Here is the log after I rebooted and removed the thing and re scanned (and added the token):

After another reboot, I’m contrantly getting these error messages:
2020-04-08 14:37:52.988 [hingStatusInfoChangedEvent] - ‘miio:generic:10212739’ changed from ONLINE to OFFLINE (CONFIGURATION_ERROR)

2020-04-08 14:37:53.190 [hingStatusInfoChangedEvent] - ‘miio:generic:10212739’ changed from OFFLINE (CONFIGURATION_ERROR) to ONLINE

Would you like me to make a log at debug level?

yes, pls make a debug level log file.
With the config error, you may want to double check the token. (note this version is based on the very recent included cloud feature, so you can also go to the binding config and enter your logon details to pull the token.). Another check thing that may cause this if there are still somehow 2 bindings running (you can check with bundle:list | grep Xiaomi , that should list only 1 entry)

Also, if you had it before as miio:unsupported device, you way want to delete it and have it discovered again as basic device.