Xiaomi Air Purifier - Show all sensors and Switches in UI and HomeKit

Hi there,

I’ve just spent many many hours on my first set up of HomeAssistant so apologies if I don’t make sense my eyes haven’t blinked for 8 hours haha. Thanks to your guide I managed to get HomeAssistant showing my Xiaomi Air Purifier 3H Temperature readout which is fantastic, however my goal is now to get that temperature read out into both Google Assistant and HomeKit so I can ask Google or Siri “Hey what’s the temperature in the living room?”

Would you have any advice on how to best achieve these because everything I’ve tried has failed. I’m pretty green to all this mind you.

Thanks :slight_smile:

Any solution for this error so it works white HomeKit?

Logger: homeassistant.components.homekit.util
Source: components/homekit/util.py:328
Integration: HomeKit (documentation, issues)
First occurred: 3:33:02 PM (2 occurrences)
Last logged: 3:33:02 PM

  • [‘Auto’, ‘Silent’, ‘Favorite’] does not contain the speed setting off as its first element. Assuming that Auto is equivalent to ‘off’
  • [‘Silent’, ‘Medium’, ‘High’, ‘Auto’] does not contain the speed setting off as its first element. Assuming that Silent is equivalent to ‘off’
1 Like

I’m having the same issue.
Does anyone knows how to fix it?

@Skaven and @Delicon
As the error notes, you didn’t have set the off status in your configuration for Homekit.

The documentation (linked in Skavens post as documentation) says:

All fans that support speed and speed_list through value mapping: speed_list is assumed to contain values in ascending order. The numeric ranges of HomeKit map to a corresponding entry of speed_list . The first entry of speed_list should be equivalent to off to match HomeKit’s concept of fan speeds. (Example: speed_list = [ off , low , high ]; off<= 33 ; low → between 33 and 66 ; high> 66 )

Thanks for the answer.
But how we should set the off state?

How do you configure Homekit? You must have enabled that somewhere (in your yaml-configuration or as an integration).

As far as I can see, you need to setup the integration via yaml, and there you put in the specific values according to the documentation. I’m sorry, I don’t use Apple products, so can’t give the exact example. :slight_smile:

I pasted settings in my configuration.yaml file:

fan:
# Example configuration.yaml entry
  - platform: xiaomi_miio
    host: 192.168.1.11
    token: ...
    model: zhimi.airpurifier.v7
    name: "filter_vazduha"

but I received error: This entity (“filter_vazduha”) does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail.

What can I do?

You don’t need to give it a unique ID. But of course add the other parts to expose the sensors and modes.

I don’t want a unique ID, but I received that error. I have pasted the rest of the code and that’s not working for me because of the same error I have received for sensors and other parts.

The error is unrelated to having a working setup.

It sounds like you are trying to edit the entity through the UI, which you can’t without a UID, but you don’t need to do this.

  1. expose sensors, automations and helpers through the copy paste code
  2. Use the entities in Lovelace cards

That’s really it.

Hi Milan,

Looks like I’ve got the same problem as you! Did you find any solution?

So I’ve managed to get the token and add my Purifier 2S to Home Assistant, but it doesn’t seem to be functioning properly. I can’t adjust the speed of the fan or get any temperature or humidity readouts. I can turn it on/off and change the mode I’m in, but the mode change works with a slider and not really properly. For example, 1% on the slider turns the purifier to Auto, 50% to sleep and 100% to user favorite. Anyone else running into this issue?

Edit: This answer finally got it working. Thanks!

Edit: still can’t set the speed for favorite mode and can’t disable the LED but that’s not super important. If anyone knows how to fix it though it would be appreciated. I’m basically getting this error:

“Failed to call service switch/turn_on. Unable to find service xiaomi_miio.fan_set_led_on”
and
" Error while executing automation automation.air_purifier_favorite_level_change: Unable to find service xiaomi_miio.fan_set_favorite_level"
“Air Purifier favorite level change: Error executing script. Service not found for call_service at pos 1: Unable to find service xiaomi_miio.fan_set_favorite_level”

I’m using your addition successfully in my configuration of the Air Purifier Pro (I can change volume successfully). Unfortunately, the core log file is showing lots of these entries (every 30 seconds):

2021-03-05 10:42:36 ERROR (MainThread) [homeassistant.components.automation.air_purifier_volume_level_changed] Air Purifier volume level changed: Error executing script. Invalid data for call_service at pos 1: expected float for dictionary value @ data['value']
2021-03-05 10:42:36 ERROR (MainThread) [homeassistant.components.automation.air_purifier_volume_level_changed] Error while executing automation automation.air_purifier_volume_level_changed: expected float for dictionary value @ data['value']

2021-03-05 10:43:06 ERROR (MainThread) [homeassistant.components.automation.air_purifier_volume_level_changed] Air Purifier volume level changed: Error executing script. Invalid data for call_service at pos 1: expected float for dictionary value @ data['value']
2021-03-05 10:43:06 ERROR (MainThread) [homeassistant.components.automation.air_purifier_volume_level_changed] Error while executing automation automation.air_purifier_volume_level_changed: expected float for dictionary value @ data['value']

2021-03-05 10:43:35 ERROR (MainThread) [homeassistant.components.automation.air_purifier_volume_level_changed] Air Purifier volume level changed: Error executing script. Invalid data for call_service at pos 1: expected float for dictionary value @ data['value']
2021-03-05 10:43:35 ERROR (MainThread) [homeassistant.components.automation.air_purifier_volume_level_changed] Error while executing automation automation.air_purifier_volume_level_changed: expected float for dictionary value @ data['value']

2021-03-05 10:44:06 ERROR (MainThread) [homeassistant.components.automation.air_purifier_volume_level_changed] Air Purifier volume level changed: Error executing script. Invalid data for call_service at pos 1: expected float for dictionary value @ data['value']
2021-03-05 10:44:06 ERROR (MainThread) [homeassistant.components.automation.air_purifier_volume_level_changed] Error while executing automation automation.air_purifier_volume_level_changed: expected float for dictionary value @ data['value']

Any idea what might be the reason, and how to get rid of it?

The latest HA version Home Assistant 2021.3.0 has fixt so fans can work better white HomeKit https://www.home-assistant.io/blog/2021/03/03/release-20213/#fan-speeds-100
Can this be used so Xiaomi air purifier works white HomeKit?

Latest HA version 2021.4.0 has introduced a brand new UI configuration for Xiaomi Fan platform.

My model is a Xiaomi Air Purifier 2H but the new UI interface is not able to identify it.
So I’ve chosen from the UI drop down menu the v2 version.
Home Assistant recognized it as fan.zhimi_airpurifier_v2 and apparently it works.
Do you think another model could be more appropriate?

Second question.
I’ve re-configured all the sensors, switches, input_select and input_number according to the new entity name ( fan.zhimi_airpurifier_v2 ) and I can see all of them.
What about the automations ( purifier_mode_change; purifier_mode_changed and so on )?
May I delete them?

Thank you for your kind attention

With the 2021.4 version managed by the interface, the component no longer detects the AQI

Some idea?

1 Like

zhimi.airpurifier.mb3 is the Air Purifier 3H (2019) model.
Is it right?
I mean … is this your model?
HA recognized it as zhimi.airpurifier.mb3 also with the previous release?

Hi there. AIR PURIFIER 3C Supported Tool?

yes , the problem is this Xiaomi Air Purifier AQI Unknown · Issue #48875 · home-assistant/core · GitHub when the value of AQI is 1

I have now other problem ,

the purifier often goes into unavailable and turns itself on when it returns

does it happen to anyone?

1 Like

It seems that this error will be fixed in the next release, removing a problematic portion of code


https://github.com/rytilahti/python-miio/pull/1007

About the random unavailable status… have you checked wi-fi related issues?