Binding request: Viessmann (API/ViCare - not vitotronic)

Tags: #<Tag:0x00007f173f143e00>

Hello,

there is a binding to integrate viessmann vitotronic, which requires additional hardware.
However, the relevant data (personally I’m interested in energy production, gas consumption and changing temperatures) are available in the ViCare-App. And quite recently (I think) they opened their system to external access via API: DeveloperPortal and DeveloperPortal

I’m not too skilled in IT/network/API-topics, so it’s not much use to me (and maybe quite a few other viessmann-customers?) at the moment.
Are there plans to develop such a binding? Would be great …

I don’t if someone is working on a binding at the moment.

But there is a way to communicate with your viessmann heating using the API. Described here:

VitoConnect is now ViCare.

Does this require a Vito Connect Unit (which I don’t have)? It’s not listed as a requirement in the article you mentioned but maybe that was too obvious to mention…

Yes, it is the gateway to connect the heating to the internet. I don’t know about other ways.
What heating do you have? Is it possible to connect directly to the internet?

I have a fuel cell heating (Brennstoffzellenheizung) which runs on gas but generates electricity as a by-product to heat; quite nice actually. And I don’t need/have additional hardware, it sends its info directly to viessmann so I can access all data via ViCare and change settings too.
So it looks like I need to be patient and hope someone will develop a binding sometime. But that’s ok, I still have enough other things to implement in OH which will keep me busy for a while …

Newer heating system from Viessmann do not require a gateway, they are connected to internet and you can consume their data using ViCare application. API from viessmann is not yet opened, I’m registered for updates and I will post as soon as API gets available and public.

As mentioned, you can use the PHP library above. I personally have implemented GitHub - somm15/PyViCare: Python Library to access Viessmann ViCare API

Then within a python script I update openhab values every 10min.

Function to update openhab items

def ohPutValue(self, item, value):
    rc = requests.put('http://'+OpenHABIP+'/rest/items/'+item+'/state', str(value),headers={'Content-type': 'text/plain'})
    if(rc.status_code != 202):
        print("Warning: couldn't save item "+item+" to openHAB")
        exit(1)

Call Viessmann API and update openhab

    self.ohPutValue('Viessmann_HWTargetTemperature',session.getDomesticHotWaterConfiguredTemperature())
    self.ohPutValue('Viessmann_HWCurrentTemperature',session.getDomesticHotWaterStorageTemperature())
    self.ohPutValue('Viessmann_supplyTemperature',session.getSupplyTemperature())
    self.ohPutValue('Viessmann_activeProgram',session.getActiveProgram())
    self.ohPutValue('Viessmann_activeMode',session.getActiveMode())
    self.ohPutValue('Viessmann_getOneTimeCharge',session.getOneTimeCharge())
    self.ohPutValue('Viessmann_outsideTemperature',session.getOutsideTemperature())

Can’t wait to have API access to further deep dive into the heating system and the smart climate devices I’m using too.

This looks promising but maybe a little too difficult for a beginner like me. I think I’ll wait for the API too, and then invest some time trying to get it connected to openhab.

If you are running openhab from a Linux box

1- install pyvicare from the repository

# pip3 install pyvicare

2- create a python script with the following (change username and password to the same you are using for the vicare application)

#!/usr/bin/python3

import argparse
import sys
import logging
import requests
from requests import Session
from PyViCare.PyViCareGazBoiler import GazBoiler

# ViCare Credentials
username = '<username>'
password = '<password>'

# OpenHAB
OpenHABIP = 'localhost:8080'

class ViCareConnectHeating(object):

    def ohPutValue(self, item, value):
        rc = requests.put('http://'+OpenHABIP+'/rest/items/'+item+'/state', str(value),headers={'Content-type': 'text/plain'})
        if(rc.status_code != 202):
            print("Warning: couldn't save item "+item+" to openHAB")
            exit(1)

    def ohGetValue(self, item):
        rc = requests.get('http://'+OpenHABIP+'/rest/items/'+item)
        print(rc.content)
        if(rc.status_code != 200):
            print("Status code ", rc.status_code)
            print("Warning: couldn't get item " + item + " from openHAB")
        data = json.loads(rc.content)
        return data['state']

    def queryData(self, session):
        self.ohPutValue('Viessmann_HWTargetTemperature',session.getDomesticHotWaterConfiguredTemperature())
        self.ohPutValue('Viessmann_HWCurrentTemperature',session.getDomesticHotWaterStorageTemperature())
        self.ohPutValue('Viessmann_supplyTemperature',session.getSupplyTemperature())
        self.ohPutValue('Viessmann_activeProgram',session.getActiveProgram())
        self.ohPutValue('Viessmann_activeMode',session.getActiveMode())
        self.ohPutValue('Viessmann_getOneTimeCharge',session.getOneTimeCharge())
        self.ohPutValue('Viessmann_outsideTemperature',session.getOutsideTemperature())

    def doCommand(self, session, command):
        if (command == 'activatecharge'):
            print('One time charge')
            session.activateOneTimeCharge()
        elif (command == 'desactivatecharge'):
            print('desactivate time charge')
            session.deactivateOneTimeCharge()

def main():

    usage = '%prog [options] arg'
    parser = argparse.ArgumentParser(usage)
    parser.add_argument('-c', action='store', dest='command', choices=['activatecharge', 'desactivatecharge'], help='send command to vicare')

    args = parser.parse_args()

    c = ViCareConnectHeating()
    t = GazBoiler(username,password,"token.save")

    if args.command:
        print('Executing: Command')
        returnVal = c.doCommand(t,args.command)
    else :
        s = c.queryData(t)

if __name__ == '__main__':
    main()

3- create openhab items

if you run the script, openhab items shall be populated. Mind that Viessmann limit the use of the API, so do not query (run the script) more than once every 10min or so.

-> run the script with no params and data gets refresh.

-> run the script with -c activatecharge or -c desactivatecharge to active / desactivation one time charge of the hot water.

Thanks for this explanation, Fred!
One thing before I start: I’m interested in current electricity production and gas consumption values. I guess I’ll have to add commands like “self.ohPutValue(‘Viessmann_HWCurrentTemperature’,session.getDomesticHotWaterStorageTemperature())” to get this. Do you know which commands exactly or how to figure them out?

The possibilities are provided by the library, see the documentation at GitHub - somm15/PyViCare: Python Library to access Viessmann ViCare API

Getting consumption is not part of it I’m afraid. I trust library (this one and others) will evolve and new possibilities will arise as viessmann opens its API platform.

I’m very interested too in getting consumption, will post here when it becomes available.

I’m also a user of Viessmann Smart Climate, if someone has information to share on how to get temperature and settings not from the Heating only but also from the Rooms associated with the heating ??

Getting temperature reading from a room is no problem within openHAB, however getting such a (non-Viessmann) reading into the heating-system would by nice. Although I doubt Viessmann will ever open such a door.

API documentation

https://htmlpreview.github.io/?https://raw.githubusercontent.com/thetrueavatar/Viessmann-Api/develop/docs/classes/Viessmann.API.ViessmannAPI.html

Seams the library from thetrueavatar has consumption tracking capabilites. Will try this week and revert.

I did a quick test drive, you can get gas consumption from thetrueavatar libraries

Here is what you get for a week

HotWater
array(8) { [0]=> int(1) [1]=> float(2.8) [2]=> float(1.5) [3]=> int(0) [4]=> int(0) [5]=> float(1.6) [6]=> float(2.9) [7]=> int(2) }
Heating
array(8) { [0]=> float(2.1) [1]=> float(6.5) [2]=> float(5.9) [3]=> float(7.3) [4]=> int(9) [5]=> float(9.1) [6]=> float(9.4) [7]=> float(9.7) }

If you need guidance on how to integrate this library in openhab see above post referencing

What I was referring to is Viessmann Smart Climate, where you have smart heating valves

image

I’m searching to get each valve data loaded in openhab for reporting, graphing, etc…

Exemple of one valve entity:

 [9]=>
            object(TomPHP\Siren\Entity)#1459 (6) {
              ["classes":"TomPHP\Siren\Entity":private]=>
              array(1) {
                [0]=>
                string(12) "model.device"
              }
              ["properties":"TomPHP\Siren\Entity":private]=>
              array(12) {
                ["gatewaySerial"]=>
                string(16) "<MASKED>"
                ["id"]=>
                string(23) "zigbee-ccccccfffe1f7c4b"
                ["boilerSerial"]=>
                NULL
                ["boilerSerialEditor"]=>
                NULL
                ["bmuSerial"]=>
                NULL
                ["bmuSerialEditor"]=>
                NULL
                ["createdAt"]=>
                string(24) "2021-02-04T18:57:12.507Z"
                ["editedAt"]=>
                string(24) "2021-02-04T18:57:12.507Z"
                ["modelId"]=>
                string(19) "E3_RadiatorActuator"
                ["status"]=>
                string(6) "Online"
                ["deviceType"]=>
                string(6) "zigbee"
                ["roles"]=>
                array(2) {
                  [0]=>
                  string(3) "trv"
                  [1]=>
                  string(12) "zigbeeDevice"
                }
              }
              ["links":"TomPHP\Siren\Entity":private]=>
              array(0) {
              }
              ["title":"TomPHP\Siren\Entity":private]=>
              NULL
              ["actions":"TomPHP\Siren\Entity":private]=>
              array(0) {
              }
              ["entities":"TomPHP\Siren\Entity":private]=>
              array(0) {
              }
            }

This is how to get valve temperature.

https://api.viessmann-platform.io/iot/v1/equipment/installations/<installationID>/gateways/<gatewayID>/devices/zigbee-<zigbeeID>/features/cs.sensors.temperature

Others of interest

cs.sensors.humidity
device.roomId
device.heatingCircuitId
device.power.battery