Skip to main content

A Python library to interact with the API behind the myVAILLANT app

Project description

MyVaillant

PyPI GitHub Workflow Status

A Python library to interact with the API behind the myVAILLANT app ((and branded versions of it, such as the MiGo app from Saunier Duval). Needs at least Python 3.10.

[!WARNING]
If you're using sensoAPP or the multiMATIC app, this library won't work for you. Try the pymultiMATIC library instead and check Vaillant's website for more information.

[!WARNING]
This integration is not affiliated with Vaillant, the developers take no responsibility for anything that happens to your devices because of this library.

MyVaillant

Install and Test

[!WARNING]

You need at least Python 3.10

pip install MyVaillant

or use Docker, if you just want to use it as a CLI tool:

docker run -ti ghcr.io/rmalbrecht/myvaillant:latest python3 -m MyVaillant.export user password brand --country country

Usage

Exporting Data about your System

python3 -m MyVaillant.export user password brand --country country
# See python3 -m MyVaillant.export -h for more options and a list of countries

The --data argument exports historical data of the devices in your system. Without this keyword, information about your system will be exported as JSON.

Exporting Energy Reports

python3 -m MyVaillant.report user password brand --country country
# Wrote 2023 report to energy_data_2023_ArothermPlus_XYZ.csv
# Wrote 2023 report to energy_data_2023_HydraulicStation_XYZ.csv

Writes a report for each heat generator, by default for the current year. You can provide --year to select a different year.

Using the API in Python

#!/usr/bin/env python3

import argparse
import asyncio
import logging
from datetime import datetime, timedelta

from myVaillant.api import MyVaillantAPI
from myVaillant.const import ALL_COUNTRIES, BRANDS, DEFAULT_BRAND

parser = argparse.ArgumentParser(description="Export data from myVaillant API   .")
parser.add_argument("user", help="Username (email address) for the myVaillant app")
parser.add_argument("password", help="Password for the myVaillant app")
parser.add_argument(
    "brand",
    help="Brand your account is registered in, i.e. 'vaillant'",
    default=DEFAULT_BRAND,
    choices=BRANDS.keys(),
)
parser.add_argument(
    "--country",
    help="Country your account is registered in, i.e. 'germany'",
    choices=ALL_COUNTRIES.keys(),
    required=False,
)
parser.add_argument(
    "-v", "--verbose", help="increase output verbosity", action="store_true"
)


async def main(user, password, brand, country):
    async with MyVaillantAPI(user, password, brand, country) as api:
        async for system in api.get_systems():
            print(await api.set_set_back_temperature(system.zones[0], 18))
            print(await api.quick_veto_zone_temperature(system.zones[0], 21, 5))
            print(await api.cancel_quick_veto_zone_temperature(system.zones[0]))
            setpoint = 10.0 if system.control_identifier.is_vrc700 else None
            print(
                await api.set_holiday(
                    system,
                    datetime.now(system.timezone),
                    datetime.now(system.timezone) + timedelta(days=7),
                    setpoint,  # Setpoint is only required for VRC700 systems
                )
            )
            print(await api.cancel_holiday(system))
            if system.domestic_hot_water:
                print(await api.boost_domestic_hot_water(system.domestic_hot_water[0]))
                print(await api.cancel_hot_water_boost(system.domestic_hot_water[0]))
                print(
                    await api.set_domestic_hot_water_temperature(
                        system.domestic_hot_water[0], 46
                    )
                )


if __name__ == "__main__":
    args = parser.parse_args()
    if args.verbose:
        logging.basicConfig(level=logging.DEBUG)
    asyncio.run(main(args.user, args.password, args.brand, args.country))

Contributing

I'm happy to accept pull requests, if you run the pre-commit checks and test your changes:

Supporting new Countries

The myVAILLANT app uses Keycloak and OIDC for authentication, with a realm for each country and brand. There is a script to check which countries are supported:

python3 -m MyVaillant.tests.find_countries

Copy the resulting dictionary into src/MyVaillant/const.py

Contributing Test Data

Because the myVAILLANT API isn't documented, you can help the development of this library by contributing test data:

python3 -m MyVaillant.tests.generate_test_data -h
python3 -m MyVaillant.tests.generate_test_data username password brand --country country

or use Docker:

docker run -v $(pwd)/test_data:/build/src/myvaillant/tests/json -ti ghcr.io/rmalbrecht/MyVaillant:latest python3 -m MyVaillant.tests.generate_test_data username password brand --country country

With docker, the results will be put into test_data/.

Please create a pull request with the created folder.

Acknowledgements

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

myvaillant-0.7.0.tar.gz (132.1 kB view details)

Uploaded Source

Built Distribution

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

myvaillant-0.7.0-py3-none-any.whl (135.9 kB view details)

Uploaded Python 3

File details

Details for the file myvaillant-0.7.0.tar.gz.

File metadata

  • Download URL: myvaillant-0.7.0.tar.gz
  • Upload date:
  • Size: 132.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for myvaillant-0.7.0.tar.gz
Algorithm Hash digest
SHA256 e75d38d356de82e81ce3087eb56c649209b69460daa32fb1898e725bca37bbcd
MD5 17089cd9ec7b18bc4a052e022f017f35
BLAKE2b-256 8c7096bc59c70cfb02cc66cb2e92369dc310d4a36423d40c15b0d24b57da6df7

See more details on using hashes here.

Provenance

The following attestation bundles were made for myvaillant-0.7.0.tar.gz:

Publisher: build.yml on rmalbrecht/myVaillant

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

File details

Details for the file myvaillant-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: myvaillant-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 135.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for myvaillant-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea428164f95f81c41235fef87a11e53983c23571f892dd230c7b2b18495f2974
MD5 78a1f3d051759f2b2465fdd250cbf61c
BLAKE2b-256 717ce228d6fa876362a5bdc69b6b503ddca2f20b5b00cf0ff49394b547a2bc33

See more details on using hashes here.

Provenance

The following attestation bundles were made for myvaillant-0.7.0-py3-none-any.whl:

Publisher: build.yml on rmalbrecht/myVaillant

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