-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for air purifiers in HomeKit #142467
Conversation
Any fan and PM2.5 in the same device will be treated as an air purifier. type_air_purifiers.py heavily based on type_fans.py - I tried extending type_fans.py but this looked better to me.
Any fan and PM2.5 in the same device will be treated as an air purifier. type_air_purifiers.py heavily based on type_fans.py - I tried extending type_fans.py but this looked better to me.
Any fan and PM2.5 in the same device will be treated as an air purifier. type_air_purifiers.py heavily based on type_fans.py - I tried extending type_fans.py but this looked better to me.
Any fan and PM2.5 in the same device will be treated as an air purifier. type_air_purifiers.py heavily based on type_fans.py - I tried extending type_fans.py but this looked better to me.
…nto homekit_air_purifier
Be more explicit than assuming a fan is an air purifier if it has a PM2.5 sensor. Set defaults based on the presence of sensors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @MaartenStaa
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with an Airversa AP 2 passed through from HKC to HomeKit 👍
Looks good. 0100 here so not able to fully double check though. Will test it some more tomorrow |
This is already exposed as a target mode on the air purifier service itself
Fix looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marking request changes for the test to make sure the auto switch isn't created for the air purifiers
Also don't remove device class when updating state in test
@bdraco I already accounted for this in the test, in the same commit: if auto_preset:
assert len(switches) == len(preset_modes) - 1
else:
assert len(switches) == len(preset_modes)
assert "smart" in switches
assert "sleep" in switches
if auto_preset:
assert auto_preset not in switches I also just pushed another commit, because I noticed some errors in my log when the state was unavailable (casting to float for the linked sensor states would fail). |
I’m going to have to pick this back up tomorrow—spent most of the day (UTC-10) debugging memory leaks and I’m pretty wiped. That said, feel free to keep things moving while I get some rest! I’m looking forward to catching up with your progress in the morning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MaartenStaa
Retested, all seems well
Proposed change
This PR allows exposing fans as air purifiers in HomeKit. It is based on #82499, which was closed without merging. Fans with an attached PM2.5 sensor are automatically exposed as air purifiers, but this can be customized via the configuration. Filter life level and filter change indication can also be exposed.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: