Skip to main content

Danfoss Ally API library

Project description

Buy Me A Coffee

Danfoss Ally API

Async-first Python client for the Danfoss Ally OpenAPI.

Installation

pip install pydanfossally

Async usage

Long-lived client

This is the recommended pattern for smart-home systems and other integrations that keep one client alive and reuse it across many calls.

from pydanfossally import DanfossAlly

ally = DanfossAlly(timeout=30)

authorized = await ally.initialize(key, secret)
if not authorized:
    raise RuntimeError("Authorization failed")

devices = await ally.get_devices()
print(devices)

await ally.aclose()

Context-managed client

This is a good fit for small scripts, one-off tools, and examples where you want automatic resource cleanup.

import asyncio
import os

from pydanfossally import DanfossAlly


async def main() -> None:
    async with DanfossAlly(timeout=30) as ally:
        authorized = await ally.initialize(os.environ["KEY"], os.environ["SECRET"])
        if not authorized:
            raise RuntimeError("Authorization failed")

        devices = await ally.get_devices()
        print(devices)


asyncio.run(main())

Supported OpenAPI endpoints

  • POST /oauth2/token
  • GET /ally/devices
  • GET /ally/devices/{device_id}
  • GET /ally/devices/{device_id}/sub-devices
  • GET /ally/devices/{device_id}/status
  • POST /ally/devices/{device_id}/commands

Notes about the data model

The transport layer follows the OpenAPI file in docs/openapi-spec.

The parsed devices mapping is a best-effort convenience model built from observed status codes. The OpenAPI file documents generic {code, value} pairs, but it does not define all device-specific status or command codes. That means:

  • request/response transport compatibility is covered by the library
  • friendly parsed fields are based on current observed API behavior
  • some status fields may vary between device types

Known gaps

  • The OpenAPI file does not fully document which command code values are supported for all device types.
  • The POST /commands response shape is inconsistent between schema and examples; this client accepts both {"result": true, "t": ...} and {"t": ...}.
  • Live verification should be performed against read-only endpoints before enabling write flows in production integrations.

Local verification

The repository includes test.py as a small async read-only example that uses credentials from the environment.

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

pydanfossally-1.0.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

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

pydanfossally-1.0.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file pydanfossally-1.0.0.tar.gz.

File metadata

  • Download URL: pydanfossally-1.0.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for pydanfossally-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3f8528cf626070e3bd2256a6fc5e28c933a555ad6c1d17d03e564bd78ff31691
MD5 ab80a24a1db0bf7472cf1c75ca629ab3
BLAKE2b-256 cb64a512492bc2b03eb9b1bee9032321cf2f1a142a5642af3f4c0dd783a6dfaf

See more details on using hashes here.

File details

Details for the file pydanfossally-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pydanfossally-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for pydanfossally-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abd861c1d3a9bd1e563b76c17ef149d0fca164442135536a5f25496818091d0c
MD5 7b3e7213e58e28790a9628c9a517c859
BLAKE2b-256 b6fb4312b0648e8e34a46645d122152db20ce89f976483cf243eccaa75d91fae

See more details on using hashes here.

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