aioairctrl

raw JSON →
0.3.1 verified Fri May 01 auth: no python

Library for controlling Philips air purifiers using encrypted CoAP. Currently at version 0.3.1, released on 2025-11-13. Active development, with frequent releases.

pip install aioairctrl
error ImportError: cannot import name 'CoAPClient' from 'aioairctrl'
cause Incorrect import path; CoAPClient is exported from aioairctrl, not aioairctrl.client.
fix
Use from aioairctrl import CoAPClient.
error RuntimeError: asyncio.run() cannot be called from a running event loop
cause Calling asyncio.run() inside an async context (e.g., Jupyter notebook or another async function).
fix
Call await main() instead of asyncio.run() in async environments.
breaking In v0.3.0, the import path for CoAPClient changed from `aioairctrl.client` to `aioairctrl`. Old imports will raise ImportError.
fix Change imports to `from aioairctrl import CoAPClient`.
gotcha The library requires Python >=3.12. Attempting to install on older Python will fail.
fix Ensure Python 3.12+ is used.
gotcha The client uses encrypted CoAP and may fail if the device is not on the same network or if ports are blocked.
fix Verify network connectivity and that the device's CoAP port (typically 5684) is reachable.

Connects to a Philips air purifier at given IP and fetches device status.

import asyncio
from aioairctrl import CoAPClient

async def main():
    host = "192.168.1.100"
    client = await CoAPClient.create(host)
    status = await client.get_status()
    print(status)
    await client.shutdown()

asyncio.run(main())