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.0.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.6.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aioaquarite-0.6.0.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.6.0.tar.gz
Algorithm Hash digest
SHA256 e50d2b4ba95dbeff2c436f4334a8c1b16e309e7102f9b2cff073d25cee119dc4
MD5 3a7b4df2236e10cbbc6848b2a5260eb9
BLAKE2b-256 8c2b02248bad4cbf94a4115e6db1022228405856fb87b12366020e5874f8d060

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: aioaquarite-0.6.0-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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f393abe8cdb55f96208528e0173ea4f804864067a8060a57ac0ecfba6255ccfb
MD5 69e34c906aaba78e5d19c5eec5906139
BLAKE2b-256 471090ad66ddf1b76fe4d76591f8c09991afa7f92083f0525c8785ee12142131

See more details on using hashes here.

Provenance

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