Xiaomi mi air purifier 2H

Anyone has already tried to integrate the xiaomi air purifier 2H in home assistant?
This is the european version of the air purifier and in not compatible with the chinese server.

2 Likes

2S integration works fine for 2H!
I followed this thread

1 Like

lot of thanks

Hi everybody,
I have a Mi Air Purifier 2H too.
The thread above (by @MickL) was very useful and the purifier is working flawlessly since the first day.

As you probably know, its model string is zhimi.airpurifier.mc2 and it is not included in the Xiaomi_miio platform [https://www.home-assistant.io/integrations/fan.xiaomi_miio/]

As a matter of fact, the string below

model: zhimi.airpurifier.mc2

generates these errors below:

Invalid config for [fan.xiaomi_miio]: value is not allowed for dictionary value @ data['model']. Got 'zhimi.airpurifier.mc2'. (See ?, line ?).

If I would “force” configuration.yaml to see my model, which is the the right one?
Has anyone tried the ‘zhimi.airpurifier.mc2’ string or the ‘zhimi.airpurifier.ma2’ string ? Both of them are for the Air Purifier 2S model.

Thank you in advance,
Luca

I have the 3H version. It also does not connect to Mainland Chinese servers. I downloaded the older version of Mi Home and just set the server to Singapore. The log file still had the Token in it. This is for Android mind you. Not sure on iOS.
Information is here:

If using an Android device to retrieve the Access Token only v5.4.49 of Mi Home is confirmed working (December 2019). Use v5.4.49 of Mi Home locate a text file under the Smarthome/logs folder where the 32 character token is stored. There will likely be several text files in this directory, search all of them for the word ‘token’ and you should find it there. Be advised that the latest version of Mi Home does not store the token in clear text.

The iPhone app still stores the token in the SQLite db as of v4.23.4 (Nov 17, 2019).

After resetting the Wi-Fi settings of the Xiaomi robot vacuum, a new Access Token will be generated and therefore these instructions need to be followed again.

These instructions are written for the Mi Home app - not for the new RoboRock app.

This token (32 hexadecimal characters) is required for the Xiaomi Mi Robot Vacuum, Mi Robot 2 (Roborock) Vacuum, Xiaomi Philips Lights and Xiaomi IR Remote. The Xiaomi Gateway uses another security method and requires a key (16 alphanumeric chars), which can be obtained easily via a hidden menu item at the Mi-Home app or using the miio command line tool.

Hi everybody,
I just bought the Air Purifier 2H but cant get it working with HA. Can anybody help me?

Im using this configuration:

fan:
  - platform: xiaomi_miio
    name: "Xiaomi Air Purifier 2H"
    host: 192.168.xx.xx
    token: TOKEN

How did you extract the token?

Do you get any error’s in the log?

This is in the logs:

Got exception while fetching the state: Unable to discover the device 192.168.xxx.xxx
13:52:48 – xiaomi_miio_airpurifier (ERROR)

On 100% the ip address is correct and for the token Im using this extractor: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor

I have never used the extractor so can’t help you with that.

Do you have any experience with connecting Air Purifier 2H to home assistant? Im looking for some guide but nothing works for me.

Yes, I have one my self

I have just followed the guide in the integration, work for me.

I added this to configuration.yaml

fan:
  # Xiaomi Air Purifier 2H
  - platform: xiaomi_miio
    host: 192.168.xx.xxx
    token: TOKEN
    name: "Xiaomi Air Purifier 2H"

and this is in the logs:

Platform xiaomi_miio not ready yet. Retrying in 30 seconds.
19:54:41 – Fan (WARNING) - the message first appeared at 19:54:06 and is displayed 2 times

Sorry not my language :man_shrugging:t3:

Ok I solved it.

I had the home assistant on the LAN and every Wi-Fi device is on different VLAN. So LAN devices has 192.168.98.xx and Wi-Fi has 192.169.10.xx. This was the problem because miio is not working on different subnet. So I switched port on switch to same VLAN as Wi-Fi devices and it works now as a charm!

For future readers, it’s not mandatory to have the purifier in the same vlan/subnet, but if you do you’ll have to setup masquerading since the purifier ignores/blocks packets from another subnets

1 Like