Skip to main content

Connector to handle vaillant vr900/vr920 data

Project description

vr900-connector

PyPI - License Build Status Coverage Status PyPI PyPI - Status PyPI - Python Version

Please note that the project is still in beta state, it means I may do some (un)intentional breaking changes

Legal Disclaimer

This software is not affiliated with Vaillant and the developers take no legal responsibility for the functionality or security of your vaillant devices

Install

[sudo] pip install vr900-connector 

Tests

You can run tests with

pytest

Usages

Command line usage

python3 vaillant.py username password method command [command parameters]

List of commands are the name of functions in api.urls module.

Example:

python3 vaillant.py username password GET room 0

Output:

{
    "body": {
        "roomIndex": 0,
        "configuration": {
            "name": "Room name",
            "temperatureSetpoint": 17.5,
            "operationMode": "AUTO",
            "currentTemperature": 19.4,
            "childLock": false,
            "isWindowOpen": false,
            "devices": [
                {
                    "name": "Device name",
                    "sgtin": "000000000000000000000000",
                    "deviceType": "VALVE",
                    "isBatteryLow": false,
                    "isRadioOutOfReach": false
                }
            ],
            "iconId": "BEDROOM"
        },
        "timeprogram": {
            "monday": [
                {
                    "startTime": "00:00",
                    "temperatureSetpoint": 17.5
                }
            ],
            "tuesday": [
                {
                    "startTime": "00:00",
                    "temperatureSetpoint": 17.5
                }
            ],
            "wednesday": [
                {
                    "startTime": "00:00",
                    "temperatureSetpoint": 17.5
                }
            ],
            "thursday": [
                {
                    "startTime": "00:00",
                    "temperatureSetpoint": 17.5
                }
            ],
            "friday": [
                {
                    "startTime": "00:00",
                    "temperatureSetpoint": 17.5
                }
            ],
            "saturday": [
                {
                    "startTime": "00:00",
                    "temperatureSetpoint": 17.5
                }
            ],
            "sunday": [
                {
                    "startTime": "00:00",
                    "temperatureSetpoint": 17.5
                }
            ]
        }
    },
    "meta": {
        "resourceState": [
            {
                "state": "SYNCED",
                "timestamp": 1551383333000,
                "link": {
                    "rel": "child",
                    "resourceLink": "/facilities/1234567891234567891234567890/rbr/v1/rooms/0/configuration"
                }
            },
            {
                "state": "SYNCED",
                "timestamp": 1549054971000,
                "link": {
                    "rel": "child",
                    "resourceLink": "/facilities/1234567891234567891234567890/rbr/v1/rooms/0/timeprogram"
                }
            }
        ]
    }
}

Module usage

The connector is separate in two layers:

1. ApiConnector

This is the low level connector using the vaillant API and returning raw data directly coming from the API. The connector is handling the login and session. The connector able to reuse an already existing session (cookies). Two files are saved (cookies and serial number of your installation) on the file system. Default location is:

tempfile.gettempdir() + "/.vaillant_vr900_files"

but it can be overridden. Files are named .vr900-vaillant.cookies and .vr900-vaillant.serial.

Here is an example how to use it:

from vr900connector.api import ApiConnector, Urls
   
connector = ApiConnector('user', 'pass')
connector.get(Urls.facilities_list()) 

to get some information about your installation, this returns the raw response, something like this:

{
    "body": {
        "facilitiesList": [
            {
                "serialNumber": "1234567891234567891234567890",
                "name": "Name",
                "responsibleCountryCode": "BE",
                "supportedBrand": "GREEN_BRAND_COMPATIBLE",
                "capabilities": [
                    "ROOM_BY_ROOM",
                    "SYSTEMCONTROL_MULTIMATIC"
                ],
                "networkInformation": {
                    "macAddressEthernet": "12:34:56:78:9A:BC",
                    "macAddressWifiAccessPoint": "34:56:78:9A:BC:DE",
                    "macAddressWifiClient": "56:78:9A:BC:DE:F0"
                },
                "firmwareVersion": "1.1.1"
            }
        ]
    },
    "meta": {}
}

Basically, you can use

from vr900connector.api import ApiConnector
   
connector = ApiConnector('user', 'pass')
connector.get('') 

with urls from

vr900connector.api.urls

I recommend using this layer if you only want to retrieve basic data (outdoor temperature, current temperature, etc.)

2. SystemManager

This layer allows you to interact in a more friendly way with the system. The underlying connector is hidden and raw responses are mapped to more useful object.

For now, the only function is:

from vr900connector.systemmanager import SystemManager
   
manager = SystemManager('user', 'pass')
system = manager.get_system() 

The main object to manipulate is

vr900connector.model.system

Which is grouping all the information about the system.

I recommend using this layer if you want to do more complex things, e.g: if you want to get the target temperature for a room or a zone, it can become a bit complex since you have to deal with holiday mode, quick mode, quick veto, time program, etc. This layer is hiding you this complexity

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

vr900-connector-0.3.4.tar.gz (22.7 kB view details)

Uploaded Source

File details

Details for the file vr900-connector-0.3.4.tar.gz.

File metadata

  • Download URL: vr900-connector-0.3.4.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for vr900-connector-0.3.4.tar.gz
Algorithm Hash digest
SHA256 a1f388449ca827c54f368eb63624e16dd998efea33aec04d2c1a55c560846f63
MD5 544c873091446a988538be250da86c4b
BLAKE2b-256 d23cb2c91b00e7e594a8cc99504fc7b6230e21cbdd7f6a4a9309a1146ffb350c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page