Support air purifier device type in homekit

Currently, HASS-homekit exposes air purifiers as fans in homekit while homekit now has air-purifier device type that is being used by homebridge plugins (https://github.com/clauzewitz/homebridge-xiaomi-purifier#readme).

Request is to support air-purifiers as a device class in homekit integration.

Benefits:
Full features: reports temperature, humidity, aqi
Additional features: control led, buzzer, mode

Would be nice to have it also for Google Assistant

Any update on that issue?

Interested on this feature as well, would like to have the correct AQI mappings in homekit.

This feature will help to control air purifier that support homekit only.

Iā€™d love to see this too. It just currently just operating as a fan.

Iā€™d like to add my vote to this. Iā€™m trying to migrate my devices from Homebridge to Homeassistant, and this is one of the things blocking me.

I added support for a few of my devices to Homebridge, so Iā€™m hoping that Iā€™ll have enough transferrable skills to make a stab at this. Iā€™ll need to understand the device/entity structure that Homeassistant uses figure out how the Homekit component handles composite devices, brush up on my Python, and figure out how to deploy a test version to my Homeassistant box. How hard can it be? :slight_smile:

1 Like

I made some adjustments to the Homekit component that treat any fan device with an associated PM2.5 sensor as an air purifier. You can see it here: GitHub - ak6i/core at homekit_air_purifier

If you want to use this in your Home Assistant configuration, you can copy the homeassistant/components/homekit directory into your config/custom_components directory (easiest is to add the SMB add-on), and add a line to the manifest.json like:
"version" : "0.99.0",

Restart and the changes will appear. You may need to remove and re-add your Homekit bridge from the Home app on your Apple device to make things work completely.

2 Likes

Nice! Do you intend to add it to official?

Thatā€™s the plan. Iā€™ve got a PR open but itā€™ll need some work for me to get it into good enough shape (Pythonā€™s not my first language, new codebase, and other excuses).

In the meantime, do feel free to try it out and let me know any feedback you have!

2 Likes

Tried it, doesnā€™t work as Air Purifier. Also, could not find anything air purifier related in your code.

Tried it with a Levoit 300s and I wasnā€™t able to make it work. Iā€™m quite confident I installed your HomeKit component correctly.

The code is there. Take a look at core/type_air_purifiers.py at ec27121d0a7fb9587d9dcc2c5e24b32c0b803823 Ā· ak6i/core Ā· GitHub for example.

I canā€™t guarantee that this code will work with all air purifiers because I have a limited set to test with. This should theoretically work with any device that exposes both a fan and a PM2.5 sensor to Home Assistant. You may also have to do the happy dance of removing and re-adding your Home Assistant to HomeKit, removing and re-adding your air purifier from Home Assistant, or some similar action.

How do I access homeassistant/components/homekit ??

With the SMB add-on one can only see config/custom-components. But how do I get to core/homeassistant/components/homekit/ ??

Thanx

Would be great to see this make its way to HA core. Why donā€™t you submit it for review?

I really want this too. Iā€™m trying to migrate my Dyson fans from Homebridge to Home Assistant and the lack of Air Purifier support means I canā€™t group the fan and the thermostat together.

@ak6i I found your PR, but it looks like itā€™s been closed for inactivity. Do you have any plans to pick up the PR again?

1 Like

@ak6i it would be really great if you could pick this up again. This is the last device class I need and I can remove the Tradfri gateway. All of my Zigbee devices will be migrated to Sky Connect. I just canā€™t do it without the air purifiers importing correctly into HomeKit.

Big up for this, I also need HomeKit bridge to be updated to support air purifiers. @ak6i can you please revive this?

Hi,

I donā€™t have much time on my hands right now, but you can copy the homekit directory from core/homeassistant/components at homekit_air_purifier Ā· ak6i/core Ā· GitHub into your custom_components directory and then youā€™ll get the changes. There arenā€™t many updates to the homekit component so you should be fairly safe.

The only reason the PR didnā€™t make it in is due to a lack of unit tests. If anyone wants to contribute them before I get the time to write them, youā€™d be very welcome to do so :wink:

2 Likes

God I wish I knew how to code those unit tests.

Does your file will get erased if it is not integrated in the official codebase, and I there is HomeKit bridge update?

Thanks! Anyone with the required knowledge to take over this by any chance? Iā€™m happy to test and help if necessary! :rainbow: