Philips Air Purifier Climate / Fan Component

HI,

Wondering is there a possibility to integrate the Philips Air Purifier to HA ? User @HaUserFromFarAway found this command line program to control the WiFi enabled Philips Air Purifiers - https://github.com/rgerganov/py-air-control.
It is tested with AC2729 and AC2889 models. I have the AC3259 and it is working too. Can anyone try to wrap it into a HA component ?

Totally agree. The default app is not much more than a fancy remote control. Being able to do some automation based on presence, weather, air quality in- and outdoors would be awesome.
Out of the box Philips offers nothing, so HA would be the first platform where we can automate philips air purifiers/humidifiers.

Come on now!

No one with the skill and time to get this working?

All i can do is confirm that the linked python command line tool works perfectly with the Philips AC3829 (purifier + humidifier).
I have zero programming skills unfortunately, and asking around in several facebook groups did not lead to anybody with the combination of:

  • has (python/yaml) programming skills
  • owns a philips purifier
  • uses Home Assistant

If anybody is looking here that has the technical skills but does not own a philips air purifier, the python tool works, it just needs to be wrapped in a HA component.
If anybody can wrap it into a HA component, i’ll gladly test it, do whatever finetuning is needed and make a fancy lovelace card for viewing and controlling your purifier from your HA dashboard.

Would love to see an integration for this.

AC2729 on the way to me. If its nice I intent to implement it in my homeassistant setup. Will update you if i got sth

1 Like

So i reversed engineered the protocol from my new unit. My code currently is here:

If you experience problems please describe them here: https://github.com/rgerganov/py-air-control/issues/21

A custom_component for HACS is available here that uses this new protocol version 2 option (should also work with older models): https://github.com/shexbeer/philips-airpurifier

Currently it exports some attributes as well as controlling fan mode and power.
Will add services to control function, aqil, target humidity soon

3 Likes

Sir a big applause for you :slight_smile: many thanks for your hard work.

I have just tested the solution with my AC2729/50 and got the following error:

2020-02-03 13:11:53,040 - MainThread - homeassistant.components.fan - ERROR - Error while setting up platform philips-airpurifier
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/philips-airpurifier/fan.py", line 40, in setup_platform
    add_devices([PhilipsAirPurifierFan(hass, config)])
  File "/config/custom_components/philips-airpurifier/fan.py", line 76, in __init__
    self.update()
  File "/config/custom_components/philips-airpurifier/fan.py", line 102, in update
    self._pre_filter = filters["fltsts0"]
KeyError: 'fltsts0'

Have you seen such an issue so far? Also I would like to highlight that AC3259/10 works like a charm.

Update: if I try to use airctrl I have just got an empty response


tomi@media_server:~/py-air-control$ sudo airctrl --ipaddr 192.168.0.54 --protocol coap
tomi@media_server:~/py-air-control$ echo $?
0

Yes, you have probably connected your device to the cloud and Philips did some updates on your device.
The payloads of the requests to the device needs to be encrypted as it seems. My solution only works for devices that are on local control and never connected to cloud.
Follow this: https://github.com/rgerganov/py-air-control/issues/21

When you add “-d” to the command (to get debug output), you will probably see something like described in this issue.

Yes you are right, I have the same issue as described in the mentioned issue. Thanks for the quick reply.

I’m a bit confused on this thing. In HACS I only see the version of xMrVizzy and not of shexbeer. I do not need the new protocol since I have an older air purifier. Does the version of shexbeer support the fan.set_speed service? It doesn’t work for me on xMrVizzy version at least.

I made the service fan.set_speed available by adding

    @property
    def supported_features(self) -> int:
        return 1

to class PhilipsAirPurifierFan(FanEntity) in fan.py

I also made all modes work by changing set_speed in fan.py into:

    def set_speed(self, speed: str):
        values = {}
        if speed == 'Turbo':
            values['mode'] = 'M'
            values['om'] = 't'
        elif speed == 'Speed 1':
            values['mode'] = 'M'
            values['om'] = '1'
        elif speed == 'Speed 2':
            values['mode'] = 'M'
            values['om'] = '2'
        elif speed == 'Speed 3':
            values['mode'] = 'M'
            values['om'] = '3'
        elif speed == 'Auto Mode':
            values['mode'] = 'P'
        elif speed == 'Allergen Mode':
            values['mode'] = 'A'
        elif speed == 'Sleep Mode':
            values['mode'] = 'M'
            values['om'] = 's'
        self.set_values(values)

Works well for the AC2889.

Hello,

I am trying to install it on my Home Assistant Core and I am getting the “Platform error fan.philips-airpurifier - No module named ‘Cryptodome’” error in the logs.
I tried to install pyCryptodome on the virtual env and it says "
Requirement already satisfied: pycryptodome in /srv/homeassistant/lib/python3.7/site-packages (3.9.7)".

Any ideas? I have the AC1214/10 model which I think needs the coap protocol.
I got the component from https://github.com/shexbeer/philips-airpurifier

Catalin

“Check Home Assistant configuration” is reporting that I should not update as

    - Platform error fan.philips-airpurifier - No module named 'Cryptodome'

When can we expect update?

Any chance to get an update?

Are there any updates on the integration? Just bought the Philips AC1214/10 and want to connect it.

@Mistic92 @ciumagcatalin
You could try this in your venv to solve it:

pip install pycryptodomex

But then I run into the next issue:

2020-06-23 20:48:30 ERROR (MainThread) [homeassistant.components.fan] Error while setting up philips-airpurifier platform for fan
Traceback (most recent call last):
  File "/var/lib/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
    return fut.result()
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/var/lib/homeassistant/.homeassistant/custom_components/philips-airpurifier/fan.py", line 40, in setup_platform
    add_devices([PhilipsAirPurifierFan(hass, config)])
  File "/var/lib/homeassistant/.homeassistant/custom_components/philips-airpurifier/fan.py", line 76, in __init__
    self.update()
  File "/var/lib/homeassistant/.homeassistant/custom_components/philips-airpurifier/fan.py", line 102, in update
    self._pre_filter = filters["fltsts0"]
KeyError: 'fltsts0'

@shexbeer, I’m writing here since your custom component repository doesn’t have Issues enabled.

Wouldn’t be better to use rgerganov/py-air-control as git submodule instead of just copying the files?

If users want to try another repo, i got mines working without hassles this afternoon with just adding this repo in HACS: https://github.com/betaboon/philips-airpurifier

Can confirm this works perfectly!