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.4.0.tar.gz (13.2 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.4.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aioaquarite-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d8ca3bb85fdfbf0da4eb4dfe526764bd041688244b82df89be73f97501cc4fa2
MD5 76a953bc1d2b067e9b244d37ab93a1d8
BLAKE2b-256 ebb5777af42082ba1cf4ff79f381e7dc636305dc0e68d212dd1c30c93849dec4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: aioaquarite-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fb3ef382db8d35cc331db265ee6f24bceb15556c07b1764cf9e577802b0fe11
MD5 253a98d8f394c04e27c209c25af66998
BLAKE2b-256 f56fefe58e97485b12841359e5e0a91b3cd30cda2aa5979ba002a8fd2c377be9

See more details on using hashes here.

Provenance

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