Mi air purifier 4 COMPACT

Hi.

Does anyone succesfully connected xiaomi air purifier 4 COMPACT (not simple 4, not 4 PRO) into Hassio?
I would be happy if I can get any directions.

In the Xiaomi miio integration (Xiaomi Miio - Home Assistant) I do not see this model (zhimi.airp.cpa4)

Thanks in advance

1 Like

Try to use " Xiaomi miot auto"
On integration add Xiaomi miot auto
Use cloud; local and automatic will not show up the entities.

4 Likes

Thanks - that worked

How did you set it up? It shows as unavailable to me and complains in logs that it is not reachable.

1 Like

Hi,

I have the same. No “Xiaomi miot auto”. Where is it in HomeAssistant?

Thx for your help!

MJAvH

@peca89, @MJAvH

Well - the steps that worked for me:

  1. install MiHome on mobile and add purifier to to original Xiaomi app
  2. remember mail, password and region for MiHome app
  3. in HA install HACS and look for miot
  4. install Xiaomi Miot Auto integration and restart HA
  5. configure the integration using credentials and region from step 2. Use only cloud connection
  6. Profit
1 Like

I did exactly that, except I use German server. No joy. Opened issue on GitHub a few days ago.

Maybe there are different hardware revisions?! Can you also install a python-miio package on the PC in the same subnet as the purifier and check the miiocli info output?

On a PC:

  • Install python for your OS
  • pip install python-miio
  • Execute miiocli cloud list to discover tokens of your devices from your cloud account. You will need to login using your Xiaomi account
  • miiocli -d device --ip x.x.x.x --token **** info replacing your device IP and token

Yes, I’ve done:

If you need specific field - let me know - I’ll try to screenshot the correct field

Thanks, all information that I can see is the same as in my case.

I must admit that I have missed the part about selecting cloud connection explicitly. I always thought automatic should use any available method… :frowning_face: Anyway, it works now.

However, there is no motor speed control in Manual/Favorite mode. I tried to manually set the Custom service.favorite level or Custom service.moto speed rpm attributes of the created fan entity, but it appears these are read-only.

I also tried calling a service below, using parameters from https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-cpa4:1 but it does not work (not sure if I got the command right, probably not)

service: xiaomi_miot.set_property
data:
  entity_id: fan.zhimi_cpa4_21de_air_purifier_2
  field: custom-service.favorite-level
  value: 10

Air Purifier 4C(zhimi.airp.cpa4): Set miot property custom-service.favorite-level(10) failed: property not found

Well, I’ve heard a joke that all instructions should start with phrase “So the device does not work at all…”

About speed - I’m just using automatic speed and do not switch to others

I forgot to mention here that I have opened an issue on GitHub which has fixed the issue. Now connection works both in cloud and local mode, as well as in automatic mode.

I have also created a pull request to enable motor speed control when the device is in Favourite mode and it works fine.

The whole point of this is that my unit outputs low, but noticeable and unpleasant whining noise when motor rpm drops to lowest setting, either in Auto mode or manually in Favourite mode. It is actually quieter when its speed is set just above minimum than on real minimum. Therefore, Auto mode is not really useful to me, so I wanted to offload the logic of speed control to HA to avoid lowest rpm setting at all costs.

1 Like

Anyone who wants to control the cpa4 via the mushroom fan card check out what I did:

Feel free to make PR and issues :smiley:

Best and greetings from Switzerland
Marco

Sadly the miot auto does not integrate all features of the fan (i.e. fan.increase_speed does not natively work)

Since I use Mushroom for my UI, I thought why not make a fan entity for the cpa4 which allows these controls in the mushroom-fan-card

Feel free to make PR and issues :smiley:

Cheers,
Marco

Hello Marco,
Quick questions, could this be compatible with my Xiaomi Air Purifier Lite 4?
In the input_select could I add the Sleep mode, or do I have to change anything more?

Thanks :pray:t3:

Hello :slight_smile:

I bought the product today - is it possible to move with it locally? Only and not through their cloud?

Thanks

I found something like this -
What can’t be connected to locally?

Currently this integration works for me in Automatic mode (I suppose it is mixed mode - firstly cloud connection is tried and the a local connection) but it seems to me that I’ve tried a Local mode and it worked for me too

1 Like

Have you managed to get it to work with 4 Lite? :slight_smile:

is this still working ? just tried to integrate but fanspeed is not doing anything

Sorry to revive an old thread but has anyone managed to integrate the compact 4 recently?

I installed the integration , I selected cloud, it finds the device but there are no entities to it :frowning: wondering what am I doing wrong