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.5.1.tar.gz (18.5 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.5.1-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aioaquarite-0.5.1.tar.gz
Algorithm Hash digest
SHA256 77128f21bc46fec885097496972631353977d6b730d1adae4fe2f3f4b27d8fc6
MD5 eb00153d9f4a4d2f24b1abe9887a35f6
BLAKE2b-256 2a3f53ac9ac7e02c23be709b132a6334ab8cd251f9a216e3e00120f2e80c9af3

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioaquarite-0.5.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.5.1-py3-none-any.whl.

File metadata

  • Download URL: aioaquarite-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 14.8 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.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a4e83da7596c8f816524d8b4a6bd5c8d87476cec37a288e88ef21b2e17d7325
MD5 b9ae9bbdd4748c7fbf7428823c4bce98
BLAKE2b-256 d28c191fdbf5d77f643c81010dfcd260737244dcbfda845d757d45a637ae73ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioaquarite-0.5.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