PyViCare-neo


NamePyViCare-neo JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/CFenner/PyViCare
SummaryLibrary to communicate with the Viessmann ViCare API.
upload_time2024-08-20 12:05:49
maintainerChristopher Fenner
docs_urlNone
authorSimon Gillet
requires_python<4.0,>=3.11
licenseApache-2.0
keywords viessmann vicare api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyViCare

This library implements access to Viessmann devices by using the official API from the [Viessmann Developer Portal](https://developer.viessmann.com/).

## Breaking changes in version 2.27.x

- Some base classes have been renamed to provide a better support for non heating devices. See [PR #307](https://github.com/somm15/PyViCare/pull/307)

## Breaking changes in version 2.8.x

- The circuit, burner (Gaz) and compressor (Heat Pump) is now separted. Accessing the properties of the burner/compressor is moved from `device.curcuits` to `device.burners` and `device.compressor`.

## Breaking changes in version 2.x

- The API to access your device changed to a general `PyViCare` class. Use this class to load all available devices.
- The API to access the heating circuit of the device has moved to the `Device` class. You can now access and iterate over all available circuits via `device.curcuits`. This allows to easily see which properties are depending on the circuit.

See the example below for how you can use that.

## Breaking changes in version 1.x

- The versions prior to 1.x used an inofficial API which stopped working on July, 15th 2021. All users need to migrate to version 1.0.0 to continue using the API.
- Exception is raised if the library runs into a API rate limit. (See feature flag `raise_exception_on_rate_limit`)
- Exception is raised if an unsupported device feature is used. (See feature flag `raise_exception_on_not_supported_device_feature`)
- Python 3.4 is no longer supported.
- Python 3.9 is now supported.

## Prerequisites

To use PyViCare, every user has to register and create their personal API client. Follow these steps to create your client:

1. Login to the [Viessmann Developer Portal](https://app.developer.viessmann.com/) with **your existing ViCare app username/password**.
2. On the developer dashboard click *add* in the *clients* section.
3. Create a new client using following data:
   - Name: PyViCare
   - Google reCAPTCHA: Disabled
   - Redirect URIs: `vicare://oauth-callback/everest`
4. Copy the `Client ID` to use in your code. Pass it as constructor parameter to the device.

Please note that not all properties from older versions and the ViCare mobile app are available in the new API. Missing properties were removed and might be added later if they are available again.

## Help

We need help testing and improving PyViCare, since the maintainers only have specific types of heating systems. For bugs, questions or feature requests join the [PyViCare channel on Discord](https://discord.gg/aM3SqCD88f) or create an issue in this repository.

## Device Features / Errors

Depending on the device, some features are not available/supported. This results in a raising of a `PyViCareNotSupportedFeatureError` if the dedicated method is called. This is most likely not a bug, but a limitation of the device itself.

Tip: You can use Pythons [contextlib.suppress](https://docs.python.org/3/library/contextlib.html#contextlib.suppress) to handle it gracefully.

## Types of heatings

- Use `asGazBoiler` for gas heatings
- Use `asHeatPump` for heat pumps
- Use `asFuelCell` for fuel cells
- Use `asPelletsBoiler` for pellets heatings
- Use `asOilBoiler` for oil heatings
- Use `asHybridDevice` for gas/heat pump hybrid heatings

## Basic Usage:

```python
import sys
import logging
from PyViCare.PyViCare import PyViCare

client_id = "INSERT CLIENT ID"
email = "email@domain"
password = "password"

vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
device = vicare.devices[0]
print(device.getModel())
print("Online" if device.isOnline() else "Offline")

t = device.asAutoDetectDevice()
print(t.getDomesticHotWaterConfiguredTemperature())
print(t.getDomesticHotWaterStorageTemperature())
print(t.getOutsideTemperature())
print(t.getRoomTemperature())
print(t.getBoilerTemperature())
print(t.setDomesticHotWaterTemperature(59))

circuit = t.circuits[0] #select heating circuit

print(circuit.getSupplyTemperature())
print(circuit.getHeatingCurveShift())
print(circuit.getHeatingCurveSlope())

print(circuit.getActiveProgram())
print(circuit.getPrograms())

print(circuit.getCurrentDesiredTemperature())
print(circuit.getDesiredTemperatureForProgram("comfort"))
print(circuit.getActiveMode())

print(circuit.getDesiredTemperatureForProgram("comfort"))
print(circuit.setProgramTemperature("comfort",21))
print(circuit.activateProgram("comfort"))
print(circuit.deactivateComfort())

burner = t.burners[0] #select burner
print(burner.getActive())

compressor = t.compressors[0] #select compressor
print(compressor.getActive())

```

## API Usage in Postman

Follow these steps to access the API in Postman:

1. Create an access token in the `Authorization` tab with type `OAuth 2.0` and following inputs:

   - Token Name: `PyViCare`
   - Grant Type: `Authorization Code (With PKCE)`
   - Callback URL: `vicare://oauth-callback/everest`
   - Authorize using browser: Disabled
   - Auth URL: `https://iam.viessmann.com/idp/v3/authorize`
   - Access Token URL: `https://iam.viessmann.com/idp/v3/token`
   - Client ID: Your personal Client ID created in the developer portal.
   - Client Secret: Blank
   - Code Challenge Method: `SHA-256`
   - Code Veriefier: Blank
   - Scope: `IoT User`
   - State: Blank
   - Client Authentication: `Send client credentials in body`.

   A login popup will open. Enter your ViCare username and password.

2. Use this URL to access your `installationId`, `gatewaySerial` and `deviceId`:

   `https://api.viessmann.com/iot/v1/equipment/installations?includeGateways=true`

   - `installationId` is `data[0].id`
   - `gatewaySerial` is `data[0].gateways[0].serial`
   - `deviceId` is `data[0].gateways[0].devices[0].id`

3. Use above data to replace `{installationId}`, `{gatewaySerial}` and `{deviceId}` in this URL to investigate the Viessmann API:

   `https://api.viessmann.com/iot/v1/features/installations/{installationId}/gateways/{gatewaySerial}/devices/{deviceId}/features`

## Rate Limits

[Due to latest changes in the Viessmann API](https://www.viessmann-community.com/t5/Konnektivitaet/Q-amp-A-Viessmann-API/td-p/127660) rate limits can be hit. In that case a `PyViCareRateLimitError` is raised. You can read from the error (`limitResetDate`) when the rate limit is reset.

## More different devices for test cases needed

In order to help ensuring making it easier to create more test cases you can run this code and make a pull request with the new test of your device type added. Your test should be commited into [tests/response](tests/response) and named `<family><model>`.

The code to run to make this happen is below. This automatically removes "sensitive" information like installation id and serial numbers.
You can either replace default values or use the `PYVICARE_*` environment variables.

```python
import sys
import os
from PyViCare.PyViCare import PyViCare

client_id = os.getenv("PYVICARE_CLIENT_ID", "INSERT CLIENT_ID")
email = os.getenv("PYVICARE_EMAIL", "email@domain")
password = os.getenv("PYVICARE_PASSWORD", "password")

vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")

with open(f"dump.json", mode='w') as output:
   output.write(vicare.devices[0].dump_secure())

```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/CFenner/PyViCare",
    "name": "PyViCare-neo",
    "maintainer": "Christopher Fenner",
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": "fenner.christopher@gmail.com",
    "keywords": "viessmann, vicare, api",
    "author": "Simon Gillet",
    "author_email": "mail+pyvicare@gillet.ninja",
    "download_url": "https://files.pythonhosted.org/packages/35/5b/03d9b198e67c40d0588270e09e0d41485fe0b40cf3ac284b8e4b267fcc0a/pyvicare_neo-0.3.0.tar.gz",
    "platform": null,
    "description": "# PyViCare\n\nThis library implements access to Viessmann devices by using the official API from the [Viessmann Developer Portal](https://developer.viessmann.com/).\n\n## Breaking changes in version 2.27.x\n\n- Some base classes have been renamed to provide a better support for non heating devices. See [PR #307](https://github.com/somm15/PyViCare/pull/307)\n\n## Breaking changes in version 2.8.x\n\n- The circuit, burner (Gaz) and compressor (Heat Pump) is now separted. Accessing the properties of the burner/compressor is moved from `device.curcuits` to `device.burners` and `device.compressor`.\n\n## Breaking changes in version 2.x\n\n- The API to access your device changed to a general `PyViCare` class. Use this class to load all available devices.\n- The API to access the heating circuit of the device has moved to the `Device` class. You can now access and iterate over all available circuits via `device.curcuits`. This allows to easily see which properties are depending on the circuit.\n\nSee the example below for how you can use that.\n\n## Breaking changes in version 1.x\n\n- The versions prior to 1.x used an inofficial API which stopped working on July, 15th 2021. All users need to migrate to version 1.0.0 to continue using the API.\n- Exception is raised if the library runs into a API rate limit. (See feature flag `raise_exception_on_rate_limit`)\n- Exception is raised if an unsupported device feature is used. (See feature flag `raise_exception_on_not_supported_device_feature`)\n- Python 3.4 is no longer supported.\n- Python 3.9 is now supported.\n\n## Prerequisites\n\nTo use PyViCare, every user has to register and create their personal API client. Follow these steps to create your client:\n\n1. Login to the [Viessmann Developer Portal](https://app.developer.viessmann.com/) with **your existing ViCare app username/password**.\n2. On the developer dashboard click *add* in the *clients* section.\n3. Create a new client using following data:\n   - Name: PyViCare\n   - Google reCAPTCHA: Disabled\n   - Redirect URIs: `vicare://oauth-callback/everest`\n4. Copy the `Client ID` to use in your code. Pass it as constructor parameter to the device.\n\nPlease note that not all properties from older versions and the ViCare mobile app are available in the new API. Missing properties were removed and might be added later if they are available again.\n\n## Help\n\nWe need help testing and improving PyViCare, since the maintainers only have specific types of heating systems. For bugs, questions or feature requests join the [PyViCare channel on Discord](https://discord.gg/aM3SqCD88f) or create an issue in this repository.\n\n## Device Features / Errors\n\nDepending on the device, some features are not available/supported. This results in a raising of a `PyViCareNotSupportedFeatureError` if the dedicated method is called. This is most likely not a bug, but a limitation of the device itself.\n\nTip: You can use Pythons [contextlib.suppress](https://docs.python.org/3/library/contextlib.html#contextlib.suppress) to handle it gracefully.\n\n## Types of heatings\n\n- Use `asGazBoiler` for gas heatings\n- Use `asHeatPump` for heat pumps\n- Use `asFuelCell` for fuel cells\n- Use `asPelletsBoiler` for pellets heatings\n- Use `asOilBoiler` for oil heatings\n- Use `asHybridDevice` for gas/heat pump hybrid heatings\n\n## Basic Usage:\n\n```python\nimport sys\nimport logging\nfrom PyViCare.PyViCare import PyViCare\n\nclient_id = \"INSERT CLIENT ID\"\nemail = \"email@domain\"\npassword = \"password\"\n\nvicare = PyViCare()\nvicare.initWithCredentials(email, password, client_id, \"token.save\")\ndevice = vicare.devices[0]\nprint(device.getModel())\nprint(\"Online\" if device.isOnline() else \"Offline\")\n\nt = device.asAutoDetectDevice()\nprint(t.getDomesticHotWaterConfiguredTemperature())\nprint(t.getDomesticHotWaterStorageTemperature())\nprint(t.getOutsideTemperature())\nprint(t.getRoomTemperature())\nprint(t.getBoilerTemperature())\nprint(t.setDomesticHotWaterTemperature(59))\n\ncircuit = t.circuits[0] #select heating circuit\n\nprint(circuit.getSupplyTemperature())\nprint(circuit.getHeatingCurveShift())\nprint(circuit.getHeatingCurveSlope())\n\nprint(circuit.getActiveProgram())\nprint(circuit.getPrograms())\n\nprint(circuit.getCurrentDesiredTemperature())\nprint(circuit.getDesiredTemperatureForProgram(\"comfort\"))\nprint(circuit.getActiveMode())\n\nprint(circuit.getDesiredTemperatureForProgram(\"comfort\"))\nprint(circuit.setProgramTemperature(\"comfort\",21))\nprint(circuit.activateProgram(\"comfort\"))\nprint(circuit.deactivateComfort())\n\nburner = t.burners[0] #select burner\nprint(burner.getActive())\n\ncompressor = t.compressors[0] #select compressor\nprint(compressor.getActive())\n\n```\n\n## API Usage in Postman\n\nFollow these steps to access the API in Postman:\n\n1. Create an access token in the `Authorization` tab with type `OAuth 2.0` and following inputs:\n\n   - Token Name: `PyViCare`\n   - Grant Type: `Authorization Code (With PKCE)`\n   - Callback URL: `vicare://oauth-callback/everest`\n   - Authorize using browser: Disabled\n   - Auth URL: `https://iam.viessmann.com/idp/v3/authorize`\n   - Access Token URL: `https://iam.viessmann.com/idp/v3/token`\n   - Client ID: Your personal Client ID created in the developer portal.\n   - Client Secret: Blank\n   - Code Challenge Method: `SHA-256`\n   - Code Veriefier: Blank\n   - Scope: `IoT User`\n   - State: Blank\n   - Client Authentication: `Send client credentials in body`.\n\n   A login popup will open. Enter your ViCare username and password.\n\n2. Use this URL to access your `installationId`, `gatewaySerial` and `deviceId`:\n\n   `https://api.viessmann.com/iot/v1/equipment/installations?includeGateways=true`\n\n   - `installationId` is `data[0].id`\n   - `gatewaySerial` is `data[0].gateways[0].serial`\n   - `deviceId` is `data[0].gateways[0].devices[0].id`\n\n3. Use above data to replace `{installationId}`, `{gatewaySerial}` and `{deviceId}` in this URL to investigate the Viessmann API:\n\n   `https://api.viessmann.com/iot/v1/features/installations/{installationId}/gateways/{gatewaySerial}/devices/{deviceId}/features`\n\n## Rate Limits\n\n[Due to latest changes in the Viessmann API](https://www.viessmann-community.com/t5/Konnektivitaet/Q-amp-A-Viessmann-API/td-p/127660) rate limits can be hit. In that case a `PyViCareRateLimitError` is raised. You can read from the error (`limitResetDate`) when the rate limit is reset.\n\n## More different devices for test cases needed\n\nIn order to help ensuring making it easier to create more test cases you can run this code and make a pull request with the new test of your device type added. Your test should be commited into [tests/response](tests/response) and named `<family><model>`.\n\nThe code to run to make this happen is below. This automatically removes \"sensitive\" information like installation id and serial numbers.\nYou can either replace default values or use the `PYVICARE_*` environment variables.\n\n```python\nimport sys\nimport os\nfrom PyViCare.PyViCare import PyViCare\n\nclient_id = os.getenv(\"PYVICARE_CLIENT_ID\", \"INSERT CLIENT_ID\")\nemail = os.getenv(\"PYVICARE_EMAIL\", \"email@domain\")\npassword = os.getenv(\"PYVICARE_PASSWORD\", \"password\")\n\nvicare = PyViCare()\nvicare.initWithCredentials(email, password, client_id, \"token.save\")\n\nwith open(f\"dump.json\", mode='w') as output:\n   output.write(vicare.devices[0].dump_secure())\n\n```\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Library to communicate with the Viessmann ViCare API.",
    "version": "0.3.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/CFenner/PyViCare/issues",
        "Changelog": "https://github.com/CFenner/PyViCare/releases",
        "Documentation": "https://github.com/CFenner/PyViCare",
        "Homepage": "https://github.com/CFenner/PyViCare",
        "Repository": "https://github.com/CFenner/PyViCare"
    },
    "split_keywords": [
        "viessmann",
        " vicare",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c8117337a23eeaba709702e625cf39ea57bcc7450704b0634e111487b911b9a",
                "md5": "94621016505ca911ae640cf89bcb58f0",
                "sha256": "095c2290a8d7981b1387a8e7270afdb12d266e4bd031b65e2090869c56f3a99c"
            },
            "downloads": -1,
            "filename": "pyvicare_neo-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "94621016505ca911ae640cf89bcb58f0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 34020,
            "upload_time": "2024-08-20T12:05:47",
            "upload_time_iso_8601": "2024-08-20T12:05:47.367517Z",
            "url": "https://files.pythonhosted.org/packages/5c/81/17337a23eeaba709702e625cf39ea57bcc7450704b0634e111487b911b9a/pyvicare_neo-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "355b03d9b198e67c40d0588270e09e0d41485fe0b40cf3ac284b8e4b267fcc0a",
                "md5": "0bafd81e116fe9cc3f31f83d084f42c2",
                "sha256": "b9f1b4269761046fc384e0b88a412485366a1ce3ba26a15de310baf57bc5cec9"
            },
            "downloads": -1,
            "filename": "pyvicare_neo-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0bafd81e116fe9cc3f31f83d084f42c2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 26158,
            "upload_time": "2024-08-20T12:05:49",
            "upload_time_iso_8601": "2024-08-20T12:05:49.117534Z",
            "url": "https://files.pythonhosted.org/packages/35/5b/03d9b198e67c40d0588270e09e0d41485fe0b40cf3ac284b8e4b267fcc0a/pyvicare_neo-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-20 12:05:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "CFenner",
    "github_project": "PyViCare",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyvicare-neo"
}
        
Elapsed time: 0.95928s