Skip to main content

Async HTTP client for the local Duco Connectivity API

Project description

python-duco-connectivity

Async Python client for the local Duco HTTP API.

python-duco-connectivity is a small async client for the unauthenticated local Duco HTTP endpoints that were validated during initial development. The library keeps its public models close to the API payload shape and is intended to stay reusable outside Home Assistant.

Installation

Until the first PyPI release is published, install directly from GitHub:

pip install git+https://github.com/ronaldvdmeer/python-duco-connectivity.git

After the package is published on PyPI, install it with:

pip install python-duco-connectivity

The package also installs a duco-probe CLI and supports module execution for quick function probes against a local Duco box. When you are not running inside an activated virtual environment, use the explicit .venv/bin/... paths shown in the development examples below.

Current scope

  • HTTP only
  • asynchronous communication via aiohttp
  • typed models that stay close to the API response shape
  • preserved raw_payload data on typed response models for forward compatibility

Getting started

import asyncio

import aiohttp

from duco_connectivity import DucoClient


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        client = DucoClient(session, "192.168.1.10")
        api_info = await client.async_get_api_info()
        nodes = await client.async_get_nodes_overview()

        print(api_info.public_api_version)
        print([node.node_id for node in nodes])


if __name__ == "__main__":
    asyncio.run(main())

Documentation map

Start with docs/api-reference.md when you want a compact inventory of the public client methods, exports, compatibility aliases, and construction rules.

  • docs/api-reference.md for the central public API inventory
  • docs/cli.md for the function probe CLI and shell examples
  • docs/config.md for system, node, and zone config reads and writes
  • docs/live-testing.md for local opt-in tests against a real Duco device
  • docs/replay-testing.md for local sample validation against ignored raw API captures
  • docs/actions.md for action discovery and execution
  • docs/nodes.md for node models and node information readers
  • docs/zones.md for zone and group info and config readers
  • docs/ventilation-states.md for ventilation enum values and compatibility members
  • docs/payload-preservation.md for raw payload preservation and raw endpoint access

The public surface keeps a split between stable typed readers and broader raw escape hatches. Use the typed methods when the model already matches the data you need, and use the raw helpers when you need endpoint coverage that has not been typed yet.

Testing strategy

The repository uses three automated test layers:

  • Synthetic unit tests cover focused parser and client behavior with mocked HTTP responses.
  • Local sample-validation tests can replay a small set of typed client methods against your own ignored raw API captures.
  • Live tests validate read paths, safe writes, and latency probes against your own Duco device.

That split matters for Duco support. Synthetic tests keep day-to-day iteration fast. Local sample validation lets you check real captures without committing them or maintaining a sanitization workflow. Live tests confirm that the client still behaves correctly against actual hardware.

Public API maintenance

The compact API reference is generated from the published exports and public async client methods. Regenerate it after public surface changes with:

python tools/api_reference.py write

Development

From the repository root, use any activated virtual environment you prefer. The commands below use a local .venv so they stay copy-pasteable from a clean checkout. Create it first if needed, then install the development dependencies and run the same checks as CI:

python -m venv .venv
.venv/bin/python -m pip install -e ".[dev]"
.venv/bin/pytest
.venv/bin/ruff check src tests
.venv/bin/ruff format --check src tests
.venv/bin/mypy src
.venv/bin/bandit -r src -ll
.venv/bin/pip-audit --desc on

For local function probes without activating the environment first:

.venv/bin/python -m duco_connectivity --host 192.168.1.10 call async_get_board_info
.venv/bin/duco-probe --host 192.168.1.10 call async_get_board_info

For local real-device validation against your own Duco box, use the opt-in workflow documented in docs/live-testing.md.

For local sample validation against ignored raw captures, use docs/replay-testing.md.

If you want to validate raw API captures locally, follow the layout guidance in docs/replay-testing.md and the fixture-specific notes in tests/fixtures/replay/README.md.

Validation

The current API surface was validated against a real Duco box during the first development pass, covering:

  • GET /api
  • GET /info with generic module, submodule, and parameter queries
  • GET /config with generic module, submodule, and parameter queries
  • PATCH /config with a no-op TimeZone write against the current value
  • GET /info?module=General&submodule=Board
  • GET /info?module=General&submodule=Lan
  • GET /info/nodes
  • GET /info?module=General&submodule=PublicApi
  • POST /action/nodes/{node} with a no-op SetVentilationState

The repository now also includes opt-in local live tests so the same read and safe-write checks can be repeated against your own device without changing the default mock-only test workflow.

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

python_duco_connectivity-0.3.0.tar.gz (47.6 kB view details)

Uploaded Source

Built Distribution

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

python_duco_connectivity-0.3.0-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file python_duco_connectivity-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for python_duco_connectivity-0.3.0.tar.gz
Algorithm Hash digest
SHA256 de1242e8b950b7226d0b35f0bc4ab5feb094fcdfb6ea0d902d2fb04f10455d2f
MD5 e6c39bb215e68a71d7ff156d100459ce
BLAKE2b-256 8bd888a811eea19bfd8162ab3010994deba09294ac536e44ec6b6ad72682b234

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_duco_connectivity-0.3.0.tar.gz:

Publisher: ci.yml on ronaldvdmeer/python-duco-connectivity

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

File details

Details for the file python_duco_connectivity-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_duco_connectivity-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30501cb5f4f021cd697faf3089c44bf74918b0728033068af9b5b02b64807540
MD5 63fe8bac83740ef64552f83a43983a00
BLAKE2b-256 c53a70252ff010ba6a615f828a3ea2e0a0a97545a93f39f794fb946031e71f76

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_duco_connectivity-0.3.0-py3-none-any.whl:

Publisher: ci.yml on ronaldvdmeer/python-duco-connectivity

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