Skip to main content

Build Status PyPI version

Command line application for controlling Philips air purifiers. Supports devices communicating over HTTP, CoAP and encrypted CoAP.

Installation

Python 3.4+ is required. Install with pip3:

$ pip3 install py-air-control

If your device is using CoAP then update the CoAPthon3 dependency to get fixes for several known bugs:

$ pip3 install -U git+https://github.com/rgerganov/CoAPthon3

Wi-Fi setup

The purifier can be connected to a Wi-Fi network with the following steps:

  1. Put the purifier into pairing mode. On AC2729 this is done by holding the power and child-lock buttons for 3 seconds. The purifier will create an open "PHILIPS Setup" wi-fi network.
  2. Connect your PC to the "PHILIPS Setup" network and get IP settings via DHCP. The IP address of the purifier will be 192.168.1.1.
  3. Now you can re-configure the wi-fi network of the purifier like this:
airctrl --ipaddr 192.168.1.1 --wifi-ssid <your_wifi_ssid> --wifi-pwd <your_wifi_password>

Note: this feature is only available for devices that work over HTTP

Usage in the local network

Getting the current status of device with IP 192.168.0.17:

$ airctrl --ipaddr 192.168.0.17
[pwr]   Power: ON
[pm25]  PM25: 4
[rh]    Humidity: 32
[rhset] Target humidity: 60
[iaql]  Allergen index: 1
[temp]  Temperature: 22
[func]  Function: Purification & Humidification
[mode]  Mode: M
[om]    Fan speed: 2
[aqil]  Light brightness: 100
[wl]    Water level: 100
[cl]    Child lock: False

You don't have to specify the IP address (--ipaddr parameter) if there is only one device in your LAN or you want to send commands to all your devices. The IP address will be autodetected using SSDP (UPnP) if the UDP 1900 port is not blocked.

You can change settings by using the prefix in the square brackets as a command line option. For example to set fan speed 2:

$ airctrl --om 2

For AC2889 you may need to specify both manual mode and fan speed:

$ airctrl --mode M --om 2

Set target humidity to 50%:

$ airctrl --rhset 50

Change function to "Purification":

$ airctrl --func P

Power off the device:

$ airctrl --pwr 0

and so on

To get filters status:

$ airctrl --filters
Pre-filter and Wick: clean in 245 hours
Wick filter: replace in 3965 hours
Active carbon filter: replace in 1565 hours
HEPA filter: replace in 3965 hours

Switching the the communication protocol

Use --protocol to switch between communication protocols. The following command will try to retrieve the current status using the CoAP protocol with encryption:

$ airctrl --ipaddr 192.168.0.17 --protocol coap

The following command will try to retrieve the current status using the CoAP protocol without encryption:

$ airctrl --ipaddr 192.168.0.17 --protocol plain_coap

Running without root privileges (Plain CoAP protocol only)

Works since Linux kernel 2.6.39.

Use id command to query your group ID:

$ id -g
995

The following command set the range of group IDs that are allowed to create ICMP sockets (ping_group_range kernel parameter, the default is "1 0", which means no group is allowed to create ICMP Echo sockets):

$ sudo sysctl -w net.ipv4.ping_group_range="0 1000"
net.ipv4.ping_group_range = 0 1000

Make it permanent:

$ echo "net.ipv4.ping_group_range=0 1000" | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -p
net.ipv4.ping_group_range = 0 1000

(see also: https://man7.org/linux/man-pages/man7/icmp.7.html)

Output of different devices

  • For further examples click here

Usage via cloud services

Use the cloudctrl script to control your device via the Philips cloud.

First you need to find your device id, provision an account and pair the account with the device id:

$ airctrl --ipaddr 192.168.0.17 --wifi
{'cppid': '9dcc618e9a82045d',
...
$ cloudctrl 9dcc618e9a82045d --pair 192.168.0.17
Creating cloud account ...
Logging in with 000000fff0000019
Client id: 000000fff10d40a1
Client key: NrIBL02WJNFDICqR6FGKig==
Exchanging secret key with the device ...
Saving session_key 512735aa3a5dc2608dfa8997b1b03a29 to /home/rgerganov/.pyairctrl
Pairing with 192.168.0.17 ...
{'return': [0]}
Logging in with 000000fff10d40a1
Sending pair request to cloud service ...
Relationship status: completed

The pairing needs to be done only once for each device, in the local network of the device.

Then you can control the paired device over the internet by using its ID and the account saved in ~/.pyairctrl:

$ cloudctrl 9dcc618e9a82045d --pwr 1
Logging in with 000000fff10d40a1
Sending event {'pwr': '1'} to device with id 9dcc618e9a82045d

Note: all IDs and credentials above are randomly generated and only used for illustration purposes Note: this feature is only available for devices that work over HTTP

Metadata

Release files for py-air-control 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-air-control 2.3.0
File Size Uploaded Provenance Actions
py-air-control-2.3.0.tar.gz 17.3 kB Without provenance Details for py-air-control-2.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-air-control 2.3.0
File Interpreter ABI Platform Actions
py_air_control-2.3.0-py3-none-any.whl Python 3 none any Details for py_air_control-2.3.0-py3-none-any.whl

Total release size: 42.8 kB

Release files / py-air-control-2.3.0.tar.gz

Download URL py-air-control-2.3.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0e76ae34beccaef695e5c968029ba82d3e921ffa14971d9100c75cb0ff53f9f1
BLAKE2b-256 checksum
How to use checksums
8f0ce780e86d7f7594e03a743d3148bfccd24124376b04dae38694d4e9c4e591
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.6.9

Release files / py_air_control-2.3.0-py3-none-any.whl

Download URL py_air_control-2.3.0-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35a6face93e79acea712852b848149611bfaa4e8045db12322dcc3e5a8a693fa
BLAKE2b-256 checksum
How to use checksums
d7aac411a4b38c988c9bf5ce7c945929831178d965c6fb250343d3c31d21816a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.6.9

Security for py-air-control 2.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page