Skip to main content

Async Python client for the Hayward Aquarite pool API

Project description

aioaquarite

Async Python client for the Hayward Aquarite pool API.

This library provides a standalone API client for interacting with Hayward Aquarite pool equipment via the Hayward cloud service. It is designed to be used as the backend for the Home Assistant Aquarite integration.

Installation

pip install aioaquarite

Usage

import aiohttp
from aioaquarite import AquariteAuth, AquariteClient

async with aiohttp.ClientSession() as session:
    auth = AquariteAuth(session, "user@example.com", "password")
    await auth.authenticate()

    # Stable Firebase UID (`sub` claim of the id token); useful as a
    # config-entry unique_id. Returns None before authenticate() succeeds.
    print("Firebase UID:", auth.user_id)

    client = AquariteClient(auth)

    pools = await client.get_pools()
    for pool_id, pool_name in pools.items():
        data = await client.fetch_pool_data(pool_id)
        temperature = AquariteClient.get_value(data, "main.temperature")
        print(f"{pool_name}: {temperature}°C")

    # Subscribe with built-in token refresh + reconnect (recommended).
    # The callback is invoked from the Firestore background thread;
    # asyncio consumers should wrap it with loop.call_soon_threadsafe.
    def on_update(data):
        print("Pool updated:", data.get("main", {}).get("temperature"))

    subscription = await client.subscribe_pool_resilient(pool_id, on_update)

    await client.set_value(pool_id, "filtration.mode", 1)

    # Cleanup
    await subscription.aclose()

Low-level subscription (0.3-style)

If you want to own the connection lifecycle yourself, the raw watch handle is still available:

watch = await client.subscribe_pool(pool_id, on_update)
# ... maintain token freshness, resubscribe on errors, etc. ...
watch.unsubscribe()

License

MIT

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

aioaquarite-0.6.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

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

aioaquarite-0.6.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file aioaquarite-0.6.1.tar.gz.

File metadata

  • Download URL: aioaquarite-0.6.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aioaquarite-0.6.1.tar.gz
Algorithm Hash digest
SHA256 80b1ad732e5f9326caafa102f6e75e118530d4c3130208bac0945f6f31c73895
MD5 f4a1d779b174a3973d52beba524fcd37
BLAKE2b-256 d30c8fc0621fca098b3184d51914bbd82b8511fb90888b9dbcbbafc60a204318

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioaquarite-0.6.1.tar.gz:

Publisher: publish.yml on fdebrus/aioaquarite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aioaquarite-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: aioaquarite-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aioaquarite-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 342c8c74b202ab100f76ed9d0ee1f8b4400fa3b654e065d225de04ecfd151945
MD5 dfff6c8091d4ac94fad0a3acd4d35d00
BLAKE2b-256 1b20429e28ecbd08879ac56c5c9aeba7148f2df99355a755d979192745c42951

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioaquarite-0.6.1-py3-none-any.whl:

Publisher: publish.yml on fdebrus/aioaquarite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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