A fully typed asyncio API for the Polyaire AirTouch AC controllers
Project description
pyairtouch
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())
Say Thank You
If you would like to make a donation as appreciation of my work, please use one of the links below:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyairtouch-0.9.0.tar.gz
(69.0 kB
view hashes)
Built Distribution
pyairtouch-0.9.0-py3-none-any.whl
(86.1 kB
view hashes)
Close
Hashes for pyairtouch-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6353f7189b9bb203a0c68c15c2d5124272e7e728385e78796ef271c0a769bf0 |
|
MD5 | e0ce8fffd80f7eb9a4c0030ce14ae885 |
|
BLAKE2b-256 | d393ab4eee34ea9b68da188fe1a20d5356cbad330a7c54a22dda79e1fc5d92d5 |