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

Uploaded Python 3

File details

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

File metadata

  • Download URL: upgrait_heatcontrol_api-0.2.0.tar.gz
  • Upload date:
  • Size: 26.7 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.0.tar.gz
Algorithm Hash digest
SHA256 6e0490fe83f4b06bb5aa6907898cd04d16c1417e4b1a7c41efa9f52dc46140c2
MD5 a292cab24245dd7d13934dcdf5c4cfae
BLAKE2b-256 42b49c51e41d0ddc9bbc51f21213e6f511ce06b1c9941ce1d08310a4d623c52f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for upgrait_heatcontrol_api-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2f15ed4ae01826b47d66b58dc3a09f441dfa373fd185f3ab2ae4a9b1885ca1d
MD5 8ff6637cdbf8e10ff3679f9a1ff97819
BLAKE2b-256 e7b40a01ee37a3dd48cdc5310b7393b08e90871b3a0f01c919d657b9869387fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for upgrait_heatcontrol_api-0.2.0-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