Philips Air Purifier

With airctrl manually I can send this command as often as I want without any errors, it always reports all sensors back correctly:

bash-5.0# airctrl --ipaddr 192.168.1.26 --protocol coap                                                                                         
[name]                        Name: Luftreiniger Wohnzimmer                                                                                     
[type]                        Type: AC2729                                                                                                      
[modelid]                     ModelId: AC2729/10                                                                                                
[swversion]                   Version: 0.2.1
[om]                          Fan speed: silent                                                                                                 
[pwr]                         Power: ON                                                                                                         
[cl]                          Child lock: False                                                                                                 
[aqil]                        Light brightness: 30                                                                                              
[uil]                         Buttons light: ON                                                                                                 
[mode]                        Mode: auto                                                                                                        
[func]                        Function: Purification & Humidification                                                                           
[rhset]                       Target humidity: 50                                                                                               
[rh]                          Humidity: 57                                                                                                      
[temp]                        Temperature: 22                                                                                                   
[pm25]                        PM25: 11                                                                                                          
[iaql]                        Allergen index: 3                                                                                                 
[aqit]                        Air quality notification threshold: 7                                                                             
[ddp]                         Used index: IAI                                                                                                   
[rddp]                        rddp: 0                                                                                                           
[wl]                          Water level: 100                                                                                                  
[fltt1]                       HEPA filter type: NanoProtect Filter Series 3 (FY2422)                                                            
[fltt2]                       Active carbon filter type: NanoProtect Filter AC (FY2420)                                                         
[fltsts0]                     Pre-filter and Wick: clean in 314 hours                                                                           
[fltsts1]                     HEPA filter: replace in 4754 hours                                                                                
[fltsts2]                     Active carbon filter: replace in 4754 hours                                                                       
[wicksts]                     Wick filter: replace in 4754 hours                                                                                
[range]                       range: MicroMario                                                                                                 
[Runtime]                     Runtime: 22.16 hours                                                                                              
[WifiVersion]                 WifiVersion: [email protected]                                                                                 
[ProductId]                   ProductId: 85bc26fae63611e8a1e3061302926720                                                                       
[DeviceId]                    DeviceId: 12f027641c5011eba44ebe148dc7e387                                                                        
[StatusType]                  StatusType: localcontrol                                                                                          
[ConnectType]                 ConnectType: Localcontrol                                                                                         
bash-5.0#  

That is really odd. Actually there is an open issue just like yours.

hm I dont think this is related, because when using airctrl I dont get any errors at all. It just works, even if I fire the command each second.

Are you doing it from the same device (HA)?

The issue is the empty packets are not handled in the CoAPthon3, which throws those errors.

Try to have on the log file, what the airctrl generates. It should be saved somewhere, I have no idea where. Or set it in the logging.conf file of the CoAPthon3 to see what exactly happening.

yes I am doing right from the console in the docker container.

I have switched now to command_line switches which just works:

- platform: command_line
  switches:
    luftreiniger:
      command_on: "airctrl --ipaddr 192.168.1.26 --protocol coap --pwr 1"
      command_off: "airctrl --ipaddr 192.168.1.26 --protocol coap --pwr 0"
      command_state: "airctrl --ipaddr 192.168.1.26 --protocol coap | grep Power | sed 's/^.*: //'"
      value_template: '{{ value == "ON" }}'
      friendly_name: Luftreiniger

too bad that the custom component does not work and that the further development stocks. hopefully this changes in near future :wink:

1 Like

That is genious :slight_smile:
How do you “engage” those commnads, using “button” or service?

I am using this switch in automations for turning it automatically on in the morning and off in the night.

Maybe it was not trivial just for me but a kind of good to know for those who has similar issue:

  • if you are running HA in a docker
  • using @shexbeer source
  • and have a device that can only work with ‘protocol 3’ aka the encrypted CoaP version
  • consider to update coapthon3 version to a modified one as a post step inside the container, or a build a new image, or…
pip3 install -U git+https://github.com/Tanganelli/CoAPthon3@89d5173

With that step everything showed up perfectly like a charm :slight_smile:

Ref: https://github.com/rgerganov/py-air-control

I tried it several times, but I got this error:

pi@HomeAssistant:~ $ pip3 install -U git+https://github.com/Tanganelli/CoAPthon3@89d5173
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting git+https://github.com/Tanganelli/CoAPthon3@89d5173
  Cloning https://github.com/Tanganelli/CoAPthon3 (to revision 89d5173) to /tmp/pip-req-build-yye592x4
  Did not find branch or tag '89d5173', assuming revision or ref.
Building wheels for collected packages: CoAPthon3
  Running setup.py bdist_wheel for CoAPthon3 ... error
  Complete output from command /home/pi/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-yye592x4/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-id71w6_w --python-tag cp37:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for CoAPthon3
  Running setup.py clean for CoAPthon3
Failed to build CoAPthon3
Installing collected packages: CoAPthon3
  Found existing installation: CoAPthon3 1.0.1
    Uninstalling CoAPthon3-1.0.1:
      Successfully uninstalled CoAPthon3-1.0.1
  Running setup.py install for CoAPthon3 ... done
Successfully installed CoAPthon3-1.0.1

Hello,
probably you need the python3-wheel package on your server:
python3-wheel: /usr/lib/python3/dist-packages/wheel/bdist_wheel.py

btw. for me the component doesn’t work correctly, idk why. If I load the component even the logging stops. I use other custom component which are working perfectly but if I copy this one to the custom_component directory and restart homeassistant the logging stops and everything else -but the airpurifier- works perfectly.

Thank you. I already have it. Maybe the version incorrect?

Add into /config/ui-lovelace.yaml

- title: Airpurifier Philips AC2729
icon: mdi:airpurifier
cards:
    - type: entities
    entities:          
        - entity: switch.airpurifier
        name: On/Off Airpurifier Philips AC2729

And same for sensors:

sensor:
  - platform: command_line
    name: air_airpurifier_humidity
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [rh] | sed 's/^.*: //'"
    unit_of_measurement: "%"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15
  - platform: command_line
    name: air_airpurifier_temperature
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [temp] | sed 's/^.*: //'"
    unit_of_measurement: "°C"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15
  - platform: command_line
    name: air_airpurifier_pm25
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [pm25] | sed 's/^.*: //'"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15
  - platform: command_line
    name: air_airpurifier_allergen_index
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [iaql] | sed 's/^.*: //'"
    unit_of_measurement: "AQI"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15
  - platform: command_line
    name: air_airpurifier_water_level
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [wl] | sed 's/^.*: //'"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15

Thank you. It would be very nice, but unfortunately command_line does not work in docker… :frowning:

After some struggle, I feel I’m getting closer with your guys help here! I own two Philips AirPurifier, model AC2889/10 and model AC2729/10.

  • Both are currently remotely connected via the AirMatters app.
  • Both are running the Firmware [email protected]

I can ping them both from the Raspi that runs HA 2020.12.1.

Using the integration from @xMrVizzy installed via HACS didn’t get me anywhere. I then read here about the fork from @shexbeer which I installed as a replacement. Setting the new protocol: setting to 1 left me where the original integration was. However, setting the protocol: setting to 3 created new Entities in HA.

The entities can be visualized in Lovelace with a plain toggle switch, clicking on the name shows some details which reflect the data from the devices. That’s all great!

Now, communication seems to be patchy. I can switch both devices off but I cannot switch them back on. The toggle stays in switched-on state. Clicking it again seems to send a signal to the device as the devices makes its ping sound. But apparently, it is a “please switch off” signal again, as nothing happens. The device doesn’t turn on. I also noticed that the data doesn’t update. E.g. the Pm25 data stays where it was when HA connected in the first place, but when it changes in the room (and on the device), this is not reflected in HA. Waiting for several minutes sees HA updating the state. Then I can switch the device.

My feeling is, that polling is working only at long intervals and HA is not updating the true state of the device. I added scan_interval: 10 to the configuration, but that didn’t help. Being a beginner with HA: how do you tell an entity to update itself? Any suggestions for a next step?

I got mines working (not all features yet) with this repo: https://github.com/betaboon/philips-airpurifier

Just installing the repo, adding 4 lines of code to configuration.yaml :slight_smile:

Mine model is not yet fully supported at that repo, but i’m already getting data in HA, and able to switch between speed etc.

Added the raw data for my model (AC1214) to the dev, to see if he can make it fully supported. So maybe if more users can add their raw data, we can have one good repo with supported models which is very easy to install in HA.

3 Likes

Wow, thank you! It’s working with my model too (ac3858) without any problems. Would be cool to see some of the attributes (for example pm25, tvoc) as a sensor, but made it with sensor template. I’m really happy, thank you! :slight_smile:

1 Like

betaboon’s integration works perfectly for my three AC1214 purifiers.

I will see to adding the data neccessary to make my AC3259 work as well :slight_smile:

Would you mind sharing your configuration? I’ve been having some issues getting my two AC1214’s to recognize as two instead of one device.

You need to add them as a list.

In my configuration.yaml:

fan: !include_dir_merge_list manual_config/fan

And then i have a file called air_purifiers.yaml in that folder, containing the list of purifiers:


  - platform: philips_airpurifier
    host: 192.168.30.16
    model: ac1214

  - platform: philips_airpurifier
    host: 192.168.30.18
    model: ac1214

  - platform: philips_airpurifier
    host: 192.168.30.19
    model: ac1214
1 Like

That did the trick, both showing up now. Thanks for your help!

1 Like