Skip to main content

A fully typed asyncio API for the Polyaire AirTouch AC controllers

Project description

pyairtouch

PyPI - Version PyPI - Python Version PyPI - License Tests Status

A fully typed asyncio API for the Polyaire AirTouch AC controllers.

The API supports the AirTouch 4 and AirTouch 5.

A unified public API is provided that encapsulates the underlying AirTouch version.

Example

import asyncio

import pyairtouch


async def main() -> None:
    # Automatically discover AirTouch devices on the network.
    discovered_airtouches = await pyairtouch.discover()
    if not discovered_airtouches:
        print("No AirTouch discovered")
        return

    for airtouch in discovered_airtouches:
        print(f"Discovered: {airtouch.name} ({airtouch.host})")

    # In this example we use the first discovered AirTouch (typically there is only one per network)
    airtouch = discovered_airtouches[0]

    # Connect to the AirTouch and read initial state.
    success = await airtouch.init()

    async def _on_ac_status_updated(ac_id: int) -> None:
        aircon = airtouch.air_conditioners[ac_id]
        print(
            f"AC Status  : {aircon.power_state.name} {aircon.mode.name}  "
            f"temp={aircon.current_temperature:.1f} set_point={aircon.target_temperature:.1f}"
        )

        for zone in aircon.zones:
            print(
                f"Zone Status: {zone.name:10} {zone.power_state.name:3}  "
                f"temp={zone.current_temperature:.1f} set_point={zone.target_temperature:.1f} "
                f"damper={zone.current_damper_percentage}"
            )

    # Subscribe to AC status updates:
    for aircon in airtouch.air_conditioners:
        aircon.subscribe(_on_ac_status_updated)

        # Print initial status
        await _on_ac_status_updated(aircon.ac_id)

    # Keep the demo running for a few minutes
    await asyncio.sleep(300)

    # Shutdown the connection
    await airtouch.shutdown()


if __name__ == "__main__":
    asyncio.run(main())

A more detailed example can be found in examples/example.py. The example can be run using the pdm run example command.

Say Thank You

If you would like to make a donation as appreciation of my work, please use one of the links below:

Coindrop.to me Buy Me A Coffee

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyairtouch-3.3.0.tar.gz (81.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyairtouch-3.3.0-py3-none-any.whl (100.6 kB view details)

Uploaded Python 3

File details

Details for the file pyairtouch-3.3.0.tar.gz.

File metadata

  • Download URL: pyairtouch-3.3.0.tar.gz
  • Upload date:
  • Size: 81.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.26.7 CPython/3.14.4 Linux/6.17.0-1010-azure

File hashes

Hashes for pyairtouch-3.3.0.tar.gz
Algorithm Hash digest
SHA256 292fc136125d5b9f28023300ed6f7ed4ec8eb31a180eceb87f87f1ed3169305f
MD5 ccb19720f6eea45f9f4074e8a18ec190
BLAKE2b-256 839d2c91fc37a8272b098f2fdb2e8dc8dc8369ec11b6b5cbc8d844b627122e55

See more details on using hashes here.

File details

Details for the file pyairtouch-3.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyairtouch-3.3.0-py3-none-any.whl
  • Upload date:
  • Size: 100.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.26.7 CPython/3.14.4 Linux/6.17.0-1010-azure

File hashes

Hashes for pyairtouch-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efc94f43a6db11d0d56f8235996327130c9f6ebf3c15e06379eb3ad2135656e2
MD5 1898c25e007047b48095bdc4cad47049
BLAKE2b-256 5a88b9117ca03b9cf6c06e890e47fa32b336327e3d84a63ac44eeb711b4eb327

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page