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.0.tar.gz (17.9 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.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aioaquarite-0.5.0.tar.gz
  • Upload date:
  • Size: 17.9 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.0.tar.gz
Algorithm Hash digest
SHA256 2fd5746363b81cfe1d920fc5167f3f5aade62b36a2a91c6d90e7021df775ed1e
MD5 3f6071f683b863a6a4b925a4fee98300
BLAKE2b-256 7c078bd84345c6f5111f18794ded0522746ac7b265675fbab16a48dac2d06713

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: aioaquarite-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afcff05c9aa83aa3f8e2b222fde973ed153940afca9506e18786d627048e2926
MD5 d9ac235b995628c7a5c2e4090a94062e
BLAKE2b-256 bb9b61cff827efb6a15063b6645349d4490276ec6adbf5c7931c744e046da7f6

See more details on using hashes here.

Provenance

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