Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

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.

Files for vr900-connector, version 0.3.4
Filename, size File type Python version Upload date Hashes
Filename, size vr900-connector-0.3.4.tar.gz (22.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page