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?
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.
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!
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?
@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
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!
While I think it would be great for HomeKit Bridge to support air purifiers, I would hesitate to endorse a system that automatically assumes just because an air quality sensor is present with a fan it means the device is an air purifier — I have air purifiers without built-in sensors, and I also added a PMS7001 to my range extraction fan but it doesn’t do any purification so I would prefer it still appear as a fan despite the co-existent sensor.
Instead I could envision an option similar to HomeKit valve support, which gives you the option to declare a switch as a valve type when bridging to HomeKit in accessory mode. Similarly, it would make sense to have the option to bridge a fan to HomeKit as an air purifier, for example something like this:
homekit:
- name: "Fan as Air Purifier"
port: 12345
mode: accessory
filter:
include_entities:
- fan.custom_fan_name
- sensor.optional_pm_2.5_sensor
entity_config:
fan.custom_fan_name:
type: air_purifier
Any update on this matter? I’ve tried Aki’s code but did not work with my Levoit Vital 100s
Hi, I tried this and it didn’t work. I believe I did everything right but can you explain it step-by-step what we should do? I’m trying to connect my IKEA Air Purifier but even with z2m and homebridge it doens’t work. With HA appears has a fan and with homebridge only appears the sensors.
Thank you for your work and help would be much apreciated.