Xiaomi Mi Air Purifier (Xiaomi Mi IO)

If you try, pull the file once more, as I saw an issue that probable cause empty commands to be send…
and uploaded once more… seems now it can process a miot response… at least how I expect it to be from your test
the db file also changed from the previous
zhimi.airpurifier.mb3miot.json (2.2 KB)

Sorry for the delay. I wasn’t aware of the cloud thing. Went through the binding doc and noticed there is no need for a token as long as I input my credentials in the binding config.
Strangely, the roborock that uses same binding worked fine. Now I removed the purifier and configured the credentials in the binding and rebooted. Of course, the purifier was discovered again and I added it as thing. It, unfortunately it showed a config error and went offline.
I inserted the old token value and it went Unsupported with the channels and stuff but they were not performing at all (same simptoms as above). So, do I input the credentials for the cloud in Binding but what about the token, does it gets auto-discovered? Or do I need to input it?
Help me clarify this and I’ll enable debugging and share the log.
Thanks,
R

Indeed it is suppose to find the token automatically…
In the discovery you than see all of the things changing to a " with token ’ in the description

Maybe it is defined in another server than your vacuum? (Or on multiple, than the binding does not know which one to pick)
In the debug log it gives all found tokens. If you leave the server empty it will try all known servers

I was expecting it would be discovered as basic thing, but if not than manually add it as a basic thing.

Something’s strange. For some reason Binding config is no longer available so I cannot configure cloud credentials. However, I removed the thing rebooted to have it discovered, then enabled debugging and added the token manually.
Here’s the log.

https://drive.google.com/open?id=147SUluHlcd22bVeQMxa7LBq_BzlxjfrN

If it’s not helpful, let me know what steps to perform.
Thanks,
R

So, I removed the binding and the THINGS completely, updated to the latest SNAPSHOT and reinstalled the binding.
This time it discovered the things automatically and got the tokens as well. :slight_smile:
The AirPurifier wend Unknown Mi IO Device (with token).
I started the debug and sent some commands. Please have a look.

don’t know why, but it looks like the old version of the binding with the new json file from the forum.
I made another update, also including all the channels that the device is suppose to have (can almost not believe so many are really available, hence the responses will be interesting)

To be sure the right is installed, maybe you can do the following in the console:

bundle:list | grep "Xiaomi Mi IO"
bundle:uninstall 265  <- replace the number with the the bundle number found with the previous command
bundle:install http://verpaalen.com/openhab2/org.openhab.binding.miio-2.5.4-SNAPSHOT.jar
bundle:start 266 <- replace the number with the the bundle number returned from the install command
log:set debug org.openhab.binding.miio
log:tail org.openhab.binding.miio
```

Yes, it seems there were two versions (one in waiting and one active state). I installed your version, removed the thing, rebooted. Here is the log. Now it got discovered (still Unknown) but this time it is getting the values correctly, however the commands are not working (power on / off).

If you have multiple binding entries indeed, repeat the uninstall line for each found bundle.

In the log, I see what is the problem. The earlier version of the json file is there.
Please remove the old json file from your misc/miio folder as the format has slightly changed
The new format is included in the binding itself.

The good thing what I see is that the commands are send well and the responses from the device are there as well. With the correct json the send command will also most likely work.

removed the json, rebooted and re-added the thing back. Unfortunatelly it’s no longer working.

Thanks for testing.
I see that the channels are not created now. Don’t quite understand why. That part of the binding was not changed. I’ll do some local testing for that.

Also I see still an issue with the sending of commands which I think is due to my new logic, which should be easy solvable.

On the positive side
From the responses I can see that the enormous amount of properties actually are getting results from the device, except a few hardware related ones. These I’ll take out from the database in the next build.

Should I collect another debug while removing and re-adding the device?

It needed some more massaging on the channels to fix it.
Likewise for the command handling. I think i nailed it now. Uploaded the latest to the same location

Right, some channels have started to work. Actually two: power (ON/OFF) and the humidity. The rest of them don’t seem to. The AQI / PM2.5 is “N/A”, the mode, LED and buzzer are not working. I’m pressing the button and immediatelly turns back the way it was. Same for Mode, I set a value and immediately goes back. Ths sounds to me that the value reading is working but the command not on these 3 ones.

can you once more make a log file like you did before.
I also expect it is now no longer reported as unsupported, but instead as a basic device, right?

Right, it is now:
Mi Air Purifier 3
Xiaomi Mi Basic Device

I will run a debug a bit later on.

Here is another log.

I clicked some commands during the session. As I said, the only one working was the power toggle. And the only reading was the humidity.
AQI is displayed as “-” and the temperature is missing completely.
Thanks

somehow it seems the old database file was picked up again. (which wasn’t the case in the previous)

Please remove the old json file from your misc/miio folder as the format has changed
The new format is included in the binding itself.

looked again in the folder. It’s empty. Should I look someplace else?

Very strange.
During the starting of the binding, or after changing the config of the device it prints the used database path.

Anyway, the intended file can be downloaded here. you can put this newer in the misc/miio folder, than it should be picked up and replacing what was in the binding.

OK, now I have a host of channels. All values seem to have the proper values, however I no longer see the “Power” switch (or it may have another name). And the commands don’t seem to work. Mode - tried changing it but it reverted to previous value. Same with the other switches.