Viessmann API Python Client
A Python library for accessing the Viessmann Climate Solutions API. Designed for integration with Home Assistant and other async Python applications.
Features
- Asynchronous: Built on
aiohttpandasyncio. - OAuth2 Authentication: Handles token retrieval and automatic renewal.
- Auto-Discovery: Automatically finds installations, gateways, and devices.
- Recursive Feature Flattening: Converts complex nested API responses into a simple, flat list of features (e.g.,
heating.circuits.0.heating.curve.shift). - Gateway-Scoped Refresh: Refreshes multiple known devices with one normal-case request while preserving partial successes.
- Command Execution: Supports safe single-feature writes with automatic parameter resolution and explicit multi-parameter commands.
- Fixture-backed Client: Runs the same client workflows against bundled real-device responses without authentication, sessions, or network requests.
- Strictly Typed: Ships as a PEP 561 complete package with
py.typed; the shipped code passes strict Pyright and dynamic values follow a typed JSON value contract.
Public API
Import consumer-facing symbols from vi_api_client:
from vi_api_client import (
AbstractAuth,
DEFAULT_SCOPES,
Device,
ENDPOINT_AUTHORIZE,
ENDPOINT_TOKEN,
EventHistoryPage,
EventHistoryWindow,
Feature,
FeatureConstraints,
FeatureDeprecation,
FeatureValue,
Gateway,
GatewayDeviceRefreshResult,
Installation,
InstallationEvent,
JsonValue,
FixtureViClient,
OAuth,
ScheduleConstraints,
ValidationDetail,
ViAuthError,
ViClient,
ViCommandRejectedError,
ViConnectionError,
ViDeviceCommunicationError,
ViError,
ViNotFoundError,
ViRateLimitError,
ViResponseError,
ViServerInternalError,
ViValidationError,
format_feature,
redact_device,
redact_feature,
redact_sensitive,
validate_json_value,
)
DEFAULT_SCOPES, ENDPOINT_AUTHORIZE, and ENDPOINT_TOKEN support external
OAuth integrations. JsonValue, FeatureValue, ValidationDetail, and
validate_json_value form the public recursive JSON value contract that
dynamic feature values and API validation details follow. redact_sensitive,
redact_feature, and redact_device redact secrets, address data,
identifiers, and coordinates in log text, API documents, and model objects.
CLI helpers, transport details, persistence, and parsing remain available from
their dedicated modules.
Installation
Requires Python 3.14+. Install the released package from PyPI:
python3.14 -m venv .venv
source .venv/bin/activate
pip install vi_api_client
To work on the library itself, install it from a clone in editable mode:
git clone https://github.com/ignazhabibi/vi_api_client.git
cd vi_api_client
pip install -e .
Development and Tests
Install the development dependencies with the CI constraints to reproduce the tested HTTP client and mock combination locally:
python -m pip install -c constraints-ci.txt '.[dev]'
pre-commit install
ruff check .
ruff format --check .
pyright --pythonpath python
pyright --project pyrightconfig.strict.json
python -m pytest -q
python scripts/check_coverage.py
python -m build
python scripts/verify_distributions.py
The shipped package is strictly typed and PEP 561 complete: the strict
Pyright pass covers src/vi_api_client, the built wheel and source
distribution ship py.typed, and the installed wheel passes
pyright --verifytypes vi_api_client --ignoreexternal. Tests remain under
standard type checking. The suite must keep at least 95% line
and branch coverage over src/vi_api_client; scripts/check_coverage.py
enforces both thresholds in the quality gate.
Quick Start
CLI
The vi-client tool is the easiest way to explore the API.
# 1. Login
vi-client login --client-id <YOUR_CLIENT_ID>
# 2. List Devices
vi-client list-devices
# 3. List only enabled Features with values (auto-detects first device)
vi-client list-features --enabled --values
# 4. List Writable Features (Settings)
vi-client list-writable
# 5. List the complete installation event history (last 7 days)
vi-client list-events --days 7
See CLI Reference for more details.
Python Code
The example reads tokens from tokens.json. Create that file once with
vi-client login, or log in from Python as shown in the
Authentication reference.
import asyncio
import aiohttp
from vi_api_client import OAuth, ViClient, ViCommandRejectedError
async def main():
async with aiohttp.ClientSession() as session:
# Initialize Auth (tokens saved to tokens.json)
auth = OAuth(
client_id="YOUR_CLIENT_ID",
redirect_uri="http://localhost:4200/",
token_file="tokens.json",
websession=session,
)
client = ViClient(auth)
# 1. Get Installations & Gateways
installations = await client.get_installations()
if not installations:
return
installation = installations[0]
gateways = await client.get_gateways()
gateway = next(
(
gateway
for gateway in gateways
if gateway.installation_id == installation.id
),
None,
)
if gateway is None:
return
# 2. Discover and refresh devices behind one gateway
devices = await client.get_devices(installation.id, gateway.serial)
refresh = await client.refresh_gateway_devices(devices)
for device_id, error in refresh.errors_by_device_id.items():
print(f"Device {device_id} could not be refreshed: {error}")
if not refresh.refreshed_devices:
return
device = refresh.refreshed_devices[0]
print(f"Device: {device.model_id} ({device.status})")
# 3. Iterate Features (Flat List)
for feature in device.features:
print(f"{feature.name}: {feature.value}")
# 4. Write one Feature with automatic dependency resolution
# Find a feature that can be set right now (e.g. heating curve slope)
slope = next(
(f for f in device.features if "curve.slope" in f.name and f.is_settable),
None,
)
if slope:
print("Setting slope to 1.4...")
try:
# Use the returned device for subsequent calls.
device = await client.set_feature(device, slope, 1.4)
except ViCommandRejectedError as error:
print(f"The device rejected the write: {error}")
else:
print("✅ Success! Device updated.")
# 5. Run any command an API feature reports
holiday = "heating.operating.programs.holiday"
if "schedule" in device.get_command_names(holiday):
try:
await client.run_command(
device,
holiday,
"schedule",
{"start": "2026-12-24", "end": "2026-12-31"},
)
except ViCommandRejectedError as error:
print(f"The device rejected the command: {error}")
if __name__ == "__main__":
asyncio.run(main())
Documentation
The detailed documentation is available in the docs/ directory:
- Getting Started: Installation and First Steps.
- API Structure & Concepts: Understanding the Flat Architecture.
- Authentication & Connection: Tokens, Sessions, and Thread-Safety.
- Models Reference: Devices, Features, and Constraints.
- Client Reference: The
ViClientclass methods. - CLI Reference: Using the command line interface.
- Exceptions Reference: Handling errors.
- Architecture Guide: System structure, responsibilities, data flows, and diagrams explained for developers and non-specialists.
Metadata
Release files for vi-api-client 7.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vi_api_client-7.0.0.tar.gz | 113.3 kB | With provenance | Details for vi_api_client-7.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vi_api_client-7.0.0-py3-none-any.whl | Python 3 | none | any | Details for vi_api_client-7.0.0-py3-none-any.whl |
Total release size: 231.5 kB
Release files / vi_api_client-7.0.0.tar.gz
| Download URL | vi_api_client-7.0.0.tar.gz |
|---|---|
| Size | 113.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4ae2be6c629b72834633c3b2154a5a47a919b8f2d2ac5ff33e02b6b0fdf1d22
|
|
BLAKE2b-256 checksum How to use checksums |
40477fed897f6b0176f5fa01ff03f141542537d31324eaabdc6b80856c387014
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / vi_api_client-7.0.0-py3-none-any.whl
| Download URL | vi_api_client-7.0.0-py3-none-any.whl |
|---|---|
| Size | 118.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4406fe4c7018cb8e343cd2358f64744ce1f9c9375e656fe2f4a6d6728604b521
|
|
BLAKE2b-256 checksum How to use checksums |
1c4a9e70c42f6ab3958af337191ce1dede945e1217dfd95528c35b2f55673ca5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for vi-api-client 7.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for vi_api_client-7.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.