Skip to main content

Async Python API client for the UPGRAIT HeatControl 3rd-party connector.

Project description

upgrait-heatcontrol-api

Async Python API package for the UPGRAIT HeatControl 3rd-party connector.

The package is intended to be the external dependency consumed by the Home Assistant integration and by other 3rd-party clients.

Current feature set:

  • HTTP probing via /api/ping
  • device metadata parsing
  • pairing start via /api/pair/start
  • pairing confirmation via /api/pair/confirm
  • websocket bind/session transport
  • encrypted request/response handling over the websocket session
  • initial snapshot handling and live event subscription
  • Zeroconf service constants and discovery metadata parsing helpers

Installation:

pip install upgrait-heatcontrol-api

Example:

import asyncio

from upgrait_heatcontrol_api import HeatControlApiClient, generate_keypair


async def main() -> None:
    async with HeatControlApiClient(host="<device-ip>") as client:
        # Step 1: read device metadata
        device = await client.async_get_device_info()
        print(device.serial, device.version)

        # Step 2: generate a keypair once and persist it for subsequent connections
        private_key, public_key = generate_keypair()

        # Step 3: start pairing — the device will display a 6-digit PIN
        # (requires new local interface, firmware version > 1610)
        pairing = await client.async_start_pairing(
            ha_instance_id="example-ha-instance",
            display_name="Example Client",
            integration_version="0.1.0",
        )
        print(f"PIN expires at: {pairing.expires_at}")

        # Step 4: confirm with the PIN shown on the device
        pin = input("Enter PIN: ")
        confirm = await client.async_confirm_pairing(
            pin=pin,
            ha_instance_id="example-ha-instance",
            display_name="Example Client",
            integration_version="0.1.0",
            ha_public_key=public_key,
        )

        # Step 5: open the persistent websocket connection
        connection = await client.async_connect_and_bind(
            ha_instance_id="example-ha-instance",
            ha_private_key=private_key,
            server_public_key=confirm.server_public_key,
        )
        print("Connected. Snapshot:", connection.snapshot)


asyncio.run(main())

Notes:

  • HeatControlApiClient can manage its own aiohttp session. In that case, either use async with HeatControlApiClient(...) or call await client.close().
  • HeatControlConnection.subscribe() registers callbacks for live websocket events and returns an unsubscribe function.
  • Discovery helpers cover both the /api/ping discovery payload and Zeroconf TXT-record property normalization.

License

Licensed under the GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later). See LICENSE.

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

upgrait_heatcontrol_api-0.2.1.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

upgrait_heatcontrol_api-0.2.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file upgrait_heatcontrol_api-0.2.1.tar.gz.

File metadata

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

File hashes

Hashes for upgrait_heatcontrol_api-0.2.1.tar.gz
Algorithm Hash digest
SHA256 723a52c6061408bf610b8e7111f2eed68c6186d5219ea4fbca31721cf6a2b461
MD5 20cf2f97eb0749d027b43de4222d6132
BLAKE2b-256 b5803afbe6e0ae7f2b6d7797118230bc2d4a5a4051658ace3d664ed78467b259

See more details on using hashes here.

Provenance

The following attestation bundles were made for upgrait_heatcontrol_api-0.2.1.tar.gz:

Publisher: publish-pypi.yml on UPGRAITgmbh/upgrait-heatcontrol-api

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

File details

Details for the file upgrait_heatcontrol_api-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for upgrait_heatcontrol_api-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2fba21ae67e660d8e9047114d00dcbcdb1c63c37a5f8f96a1693eb0f8bf5dbc5
MD5 63fa77c64f4dfaaef3754db06c63c786
BLAKE2b-256 f0f8928dbc710b01c1797363c19ce914049dd21508fef87408e1c519247b669b

See more details on using hashes here.

Provenance

The following attestation bundles were made for upgrait_heatcontrol_api-0.2.1-py3-none-any.whl:

Publisher: publish-pypi.yml on UPGRAITgmbh/upgrait-heatcontrol-api

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