[oH3.0.2] Xiaomi MI IO - Can´t add things via UI or text based config

Hi there,

i´m currently trying to get everything back running after moving into a new flat and upgrading to oH 3.
I already had one Xiaomi Air Purifier in my old flat and now a second one.
The old one working fine in oH 2 with text based config.

Now i tried to get them both running in oH 3.0.2 but no matter they way i´m not able to add them as a thing.

  1. UI based local
    I added the binding (3.0.2 │ org.openhab.binding.miio) and watched the log for discovery results.
    The binding found three things but only one of them was a Air Purifier (the 2S).
    The two other results showed as generic without further information.
    I tried to add the one that showed up as basic but that failed…

  2. UI based cloud
    So i followed the bindings documentation on how to connect the binding to the cloud service of Xiaomi.
    After entering my user, password and server i got a bunch of errors in the logs…
    This is just one of like six blocks that show up.
    2021-07-30 12:10:39.628 [ERROR] [org.openhab.binding.miio ] - bundle - Pastebin.com
    After playing around a little bit i found that i couldn´t delete something i already entered in the binding cofing, e.g. i can´t delete the server country.

  3. Text based config
    I was able to look at the things file i used in my old environment and wanted to try the text based config.
    So i created a xiaomi.things file in the things folder and pasted the modified config line:

Thing miio:basic:airpurifier2S "Luftreiniger Wohnzimmer" [ host="1.2.3.4", token="<Token>", deviceId="<deviceId>", model="zhimi.airpurifier.vb2", refreshInterval="30", timeout="15000", communication="direct"]

Guess what? Nothing happens!
oH reads the things file but wont do anything with it… no error, no new things, nothing.

  1. Log level DEBUG
    Now i wanted to know what i happening and went to the console and switched the log level to DEBUG.
openhab> log:set DEBUG org.openhab.binding.miio                                                                                                                         
openhab> log:get org.openhab.binding.miio                                                                                                                             
DEBUG

Now i was able to also get the token for the second device and added this to the things file aswell.
This lead me to the following debug message:

2021-07-30 12:07:13.116 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Skipped adding local found Xiaomi Mi Device ABC (XYZ). Already discovered by cloud.
2021-07-30 12:07:13.177 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Skipped adding local found Xiaomi Mi Device CDE (ZYX). Already discovered by cloud.

So back to the inbox and remove the discovery results from the cloud.
Clear the things file, save and paste the config again.
Nothing… no error, no new things.

2021-07-30 12:12:39.792 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'xiaomi.things'

The binding is now configured as local only but still tries to get information from the cloud regularly…

2021-07-30 12:20:39.665 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"getVirtualModel":false,"getHuamiDevices":0} to https://de.api.io.mi.com/app/home/device_list
2021-07-30 12:20:39.829 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/device_list. Response: {"code":0,"message":"ok","result":{"list":[{"did":"<deviceId>","token":"<Token>","longitude":"0.00000000","latitude":"0.00000000","name":"Schlafzimmer","pid":"0","localip":"1.2.3.4","mac":"<MAC>","ssid":"Falkennest","bssid":"<MAC>","parent_id":"","parent_model":"","show_mode":1,"model":"zhimi.airpurifier.mc1","adminFlag":1,"shareFlag":0,"permitLevel":16,"isOnline":true,"desc":"Schlafen| PM2.5:5","extra":{"isSetPincode":0,"pincodeType":0,"fw_version":"1.4.3_21106","needVerifyCode":0,"isPasswordEncrypt":0},"prop":{"aqi":"5","mode":"silent","power":"on"},"uid":<UID>,"pd_id":123,"password":"","p2p_id":"","rssi":-48,"family_id":0,"reset_flag":0},{"did":"<deviceId>","token":"<Token>","longitude":"0.00000000","latitude":"0.00000000","name":"Wohnzimmer","pid":"0","localip":"1.2.3.5","mac":"<MAC>","ssid":"Falkennest","bssid":"<MAC>","parent_id":"","parent_model":"","show_mode":1,"model":"zhimi.airpurifier.vb2","adminFlag":1,"shareFlag":0,"permitLevel":16,"isOnline":true,"desc":"Gerät online ","extra":{"isSetPincode":0,"pincodeType":0,"fw_version":"2.0.8","needVerifyCode":0,"isPasswordEncrypt":0,"mcu_version":"1002"},"uid":<UID>,"pd_id":4567,"password":"","p2p_id":"","rssi":-67,"family_id":0,"reset_flag":0}]}}
2021-07-30 12:20:39.831 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Devices token info saved to /var/lib/openhab/miio/miioTokens-de.json
2021-07-30 12:20:39.834 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Xiaomi cloud info: Device name: 'Schlafzimmer', did: '<deviceId>', token: '<Token>', ip: 1.2.3.4, server: de
2021-07-30 12:20:39.835 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Xiaomi cloud info: Device name: 'Wohnzimmer', did: '<deviceId>', token: '<Token>', ip: 1.2.3.5, server: de
2021-07-30 12:20:39.837 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Cloud Info: Device name: 'Schlafzimmer', did: '<deviceId>', token: '<Token>', ip: 1.2.3.4, server: de
2021-07-30 12:20:39.837 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Cloud Info: Device name: 'Wohnzimmer', did: '<deviceId>', token: '<Token>', ip: 1.2.3.5, server: de
2021-07-30 12:20:39.839 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Discovered Mi Device ABC (<deviceId>) at 1.2.3.4 as miio:generic:<ID> with token <Token>
2021-07-30 12:20:39.839 [DEBUG] [iio.internal.discovery.MiIoDiscovery] - Discovered Mi Device DEF (<deviceId>) at 1.2.3.5 as miio:generic:<ID> with token <Token>
  1. UI based config the third
    I removed the things file and went to the inbox.
    I can see two devices with the correct names and the info “with token” at the end.
    So i tried to add them and the log prints:
2021-07-30 12:12:54.747 [WARN ] [g.discovery.internal.PersistentInbox] - Cannot create thing. No binding found that supports creating a thing of type miio:generic.

I´m out of ideas…
It´s not working with the UI and local discovery, it´s not working with the UI and cloud based discovery and it´s not working with text based config.

Any ideas?

kind regards
Michael

Seems like this issue fixed itself after the update to 3.1.0
After the update i was able to create everything with text based configs.

Things:

Thing miio:basic:airpurifierProH "Luftreiniger Wohnzimmer" [ host="<IP-address>", token="<Token>", deviceId="<deviceId>", model="zhimi.airpurifier.vb2", refreshInterval="30", timeout="15000", communication="direct"]
Thing miio:basic:airpurifier2S "Luftreiniger Schlafzimmer" [ host="<IP-address>", token="<Token>", deviceId="<deviceId>", model="zhimi.airpurifier.mc1", refreshInterval="30", timeout="15000", communication="direct"]

Items:

// Gruppe
Group gLuftreiniger "Luftreiniger" <status>

// Air Purifier 2S
Switch xLuftreinigerSchlafen "Luftreiniger" (Schlafzimmer, gLuftreiniger) {channel="miio:basic:airpurifier2S:power"}
String xLuftreinigerSchlafenMode "Modus [%s]" (Schlafzimmer, gLuftreiniger, gPersist) {channel="miio:basic:airpurifier2S:mode"}
Number xLuftreinigerSchlafenHum "Luftfeuchtigkeit [%d %%]" (Schlafzimmer, gLuftreiniger, gPersist, gInflux) {channel="miio:basic:airpurifier2S:humidity"}
Number xLuftreinigerSchlafenTemp "Temperatur [%.1f °C]" (Schlafzimmer, gLuftreiniger, gPersist, gInflux) {channel="miio:basic:airpurifier2S:temperature"}
Number xLuftreinigerSchlafenAQI "Luftqualität [%s]" (Schlafzimmer, gLuftreiniger, gPersist) {channel="miio:basic:airpurifier2S:aqi"}

// Air Purifier Pro H
//Switch xLuftreinigerWohnen "Luftreiniger" (Wohnzimmer, gLuftreiniger) {channel="miio:basic:airpurifierProH:on"}
Number xLuftreinigerWohnenMode "Modus [%s]" (Wohnzimmer, gLuftreiniger) {channel="miio:basic:airpurifierProH:mode"}
Number xLuftreinigerWohnenHum "Luftfeuchtigkeit [%d %%]" (Wohnzimmer, gLuftreiniger, gPersist, gInflux) {channel="miio:basic:airpurifierProH:relative_humidity"}
Number xLuftreinigerWohnenTemp "Temperatur [%.1f °C]" (Wohnzimmer, gLuftreiniger, gPersist, gInflux) {channel="miio:basic:airpurifierProH:temperature"}
Number xLuftreinigerWohnenAQI "Luftqualität [%s]" (Wohnzimmer, gLuftreiniger, gPersist) {channel="miio:basic:airpurifierProH:aqi_state"}
Number xLuftreinigerWohnenQuality "Luftqualität [MAP(AirQualityIndex.map):%s]"

I had to disable the Power item for the Pro H because it was switching between OFF and ON with every update.

kind regards
Michael

1 Like