[VitoConnect] Getting readings from Viessmann Heating system via VitoConnect

Hello

after removing // in boostrap.php

If I launch php GetBoilerTemperature.php
Error is

  >   "PHP Notice:  Undefined offset: 0 in phar:///etc/openhab2/scripts/Viessmann-Api-1.1-SNAPSHOT.phar/src/Oauth/ViessmannOauthClientImpl.php on line 60
>     Message: Call to a member function getProperty() on null
>     Code: 0
>     Trace:#0 phar:///etc/openhab2/scripts/Viessmann-Api-1.1-SNAPSHOT.phar/src/API/ViessmannAPI.php(44): Viessmann\Oauth\ViessmannOauthClientImpl->__construct(Array)
>     #1 /etc/openhab2/scripts/bootstrap.php(32): Viessmann\API\ViessmannAPI->__construct(Array)
>     #2 /etc/openhab2/scripts/GetBoilerStatistics.php(2): include('/etc/openhab2/s...')
>     #3 {main}

Php file looks like

<?php
include __DIR__.'/bootstrap.php';
echo $viessmannApi->getBoilerTemperature()

Thanks a lot for your help
Ludovic

Have you updated your phar to the very last version(1hour ago). Viessman server has been updated and I had to do some tweak in the way to do the Oauth part. Please update with the very last version since the error message is exactly what I had before fixing this.

EDIT:
I have released a 1.1.0 version to fix this problem: https://github.com/thetrueavatar/Viessmann-Api/releases/tag/1.1.0
1.2.0-SNAPSHOT on dev branch is also fixed.

I was getting the same error starting probably yesterday (7.July 10 local). Changed to the 1.1.0 API Version, the error is gone!

Merci beaucoup.

[Edit:]
Editional info: Viessmann had server troubles today which resulted in the ViCareApp not showing data. :wink: Did they have trouble with the change as well?:joy::joy::joy:

Hello
I update with latest version 1.1.0 and it works well :grinning:
Thank you very much for your help
A bientƓt sur le forum
Ludovic

Hello
@opus

I donā€™t understand how to bind the Item created

`String OutsideTemperature "OutsideTemperature [%s Ā°C]"` String BoilerTemerature "BoilerTemeprature [%s Ā°C]`

Iā€™ve no ā€œThingsā€ to bind the Item. In ā€˜Paper UIā€™ , the binding with Vicare donā€™t exist => Impossible to add Thing manually

I supposed, i have to create file.things manually, Can you please tell me what i have to write in file.things for this Viessman-Api
Thanks a lot
Ludovic

Hello @thetrueavatar,

thank you for your API to connect with the Viessmann Server.

I tried it, but it doesnā€™t work for me.
PHP and PHP-CURL is installed on my Raspi.
My PHP-Version is
PHP 7.3.10-1+0~20191008.45+debian8~1.gbp365209 (cli) (built: Oct 9 2019 00:23:11) ( NTS )

My GetValues.php looks like:

<?php
include __DIR__.'/bootstrap.php';
echo $viessmannApi->getOutsideTemperature();

when I start ā€œphp GetValues.phpā€ via SSH I get following error-message:

PHP Notice:  Undefined variable: viessmannApi in /etc/openhab2/scripts/GetValues.php on line 3
PHP Fatal error:  Uncaught Error: Call to a member function getOutsideTemperature() on null in /etc/openhab2/scripts/GetValues.php:3
Stack trace:
#0 {main}
  thrown in /etc/openhab2/scripts/GetValues.php on line 3

Do you have any ideas?
Thank you.

Joe

It complains that variable viessmannApi has not been declared before using it. It should have been created in the bootstrap.php. Do you have such a file in the /etc/openhab2/scripts/ directory ?
Regards

Le dim. 27 oct. 2019 Ć  22:42, Joe via openHAB Community bot@community.openhab.org a Ć©crit :

Yes,
the file bootstrap.php is in the directory /etc/openhab2/scripts/ .

I guess the reason could be the rights to execute the files:
Opus wrote in his first comment:

Could this be the reason? What is your opinion?
and how can I make the files executable for owner and Group?

Such is not an openHAB related question. Did you try to google this topic?

BTW: Under your nickname I would expect a person with such knowledge :wink:

Nor a problem related to the API itselfā€¦ I have made a bootstrap.php file sample in the example directory but I wonā€™t give in depth support for simple php instanciationā€¦ Could you just give me the content for the boostrap.php ? For right on linux just use the chmod or chown function on the file(have a look on google/ or man for usage explanation)

1 Like

Ok.
It was not a problem of the rights / permissions.
Iā€™ve checked and downloaded all files again. (including the brand-new API-File).

Now I get the following warnings:

php GetValues.php

PHP Warning:  session_start(): Cannot start session when headers already sent in phar:///etc/openhab2/scripts/Viessmann-Api-1.2.0-SNAPSHOT.phar/src/bootstrap.php on line 2
PHP Warning:  session_start(): Cannot start session when headers already sent in phar:///etc/openhab2/scripts/Viessmann-Api-1.2.0-SNAPSHOT.phar/vendor/lusitanian/oauth/src/OAuth/Common/Storage/Session.php on line 40

Thank you for your help.

Joe

hum I have already seen. afair it was because with the same session several http request have been made. However, I thought it was fixed. As itā€™s still a warning this shouldā€™nt prevent the api to work. Could you try another feature($viessmannApi->getOutsideTemperature() ?) to test if you get a result.

Thank you for your hints.

I tested the GetValues.php with different features:
boilertemperature, hotwaterstorage and burnerstatistics (hours).
Everytime the same warnings.

Then I changed the API back to the Version 1.1.0.
Same results.

Next step for me is to create a rule in openhab and check the results by ignoring the warnings.

Joe

I am using the API 1.1 every 5 minutes to request data ( OutsideAirTemp and HotWaterStorageTemp) and do not see those warnings.

First of all thank you to all who contributed to this feature and to this tread.

Iā€™m new to this so please be gentle :grinning:

Iā€™m able to get some data but as Iā€™m operating a heatpump (Vitocal 200-S) there is a lot of items that donā€™t fit my heating lay-out. E.g. getBoilerTemperature returns with FEATURE_NOT_FOUND.

However when I use getAvailableFeatures there are a lot of items that are useful but how can these be made available? Is this something I can do myself or is this upto @thetrueavatar to put into the API?

E.g. one of the items that shows up is heating.compressor. My guess is that this is the variable showing if the compressor of the heatpump is running or not. It is a useful piece of information to have in determining how efficient the heatpump is running. getCompressor is not working so Iā€™m pretty sure Iā€™m overlooking something. As said at the beginning Iā€™m new to all this.

Here is the compleet list of items after running getAvailableFeatures:

heating.circuits.0.sensors.temperature.supply
heating.primaryCircuit.sensors.temperature.supply
heating.circuits.0
heating.dhw.schedule
heating.circuits.0.operating.modes.forcedReduced
heating.circuits.0.operating.modes.forcedNormal
heating.dhw.charging
heating.circuits.0.operating.programs.eco
heating.compressor
heating.dhw.temperature
heating.circuits.0.operating.programs.fixed
heating.circuits.0.operating.programs.normal
heating.controller.serial
heating.dhw.temperature.hysteresis
heating.sensors.temperature.return
heating.circuits.0.operating.modes.active
heating.dhw.sensors.temperature.hotWaterStorage.top
heating.circuits.0.operating.programs.active
heating.errors.history
heating.compressors
heating.circuits.0.operating.programs.reduced
heating.errors.active
heating.circuits.0.operating.modes.normalStandby
heating.boiler.serial
heating.circuits.0.heating.curve
heating.dhw.temperature.temp2
heating.circuits.0.operating.programs.standby
heating.compressors.0
heating.boiler.sensors.temperature.commonSupply
heating.dhw.sensors.temperature.outlet
heating.device.time.offset
heating.sensors.temperature.outside
heating.dhw.pumps.circulation.schedule
heating.secondaryCircuit.sensors.temperature.return
heating.device.initialSetup
heating.circuits.0.frostprotection
heating.circuits.0.circulation.schedule
heating.secondaryCircuit.sensors.temperature.supply
heating.circuits.0.sensors.temperature.room
heating.primaryCircuit.sensors.temperature.return
heating.circuits.0.circulation.pump
heating.dhw.pumps.circulation
heating.configuration.cooling
heating.dhw.pumps.primary
heating.circuits
heating.circuits.0.heating.schedule
heating.circuits.0.operating.modes.standby
heating.compressors.0.statistics
heating.circuits.0.operating.programs.holiday
heating.circuits.0.operating.modes.dhw
heating.dhw.sensors.temperature.hotWaterStorage
heating.configuration.multiFamilyHouse
heating.compressor.statistics
heating.circuits.0.operating.programs.comfort
heating.dhw.sensors.temperature.hotWaterStorage.bottom
heating.dhw.temperature.main
heating.dhw
heating.device.mainECU
heating.circuits.0.operating.modes.dhwAndHeating
heating.dhw.oneTimeChargeyour code goes here

Can we expect an official binding soon? :slight_smile:

Hello, Iā€™m the developper of the API. I have implemented feature of my own heating system and feature found in a demo package in the ViCare app. However, this indeed doesnā€™t cover the whole set of feature. Basically, itā€™s quite easy to add some new feature by yourself. I have written a small guide to help people to contribute:
https://github.com/thetrueavatar/Viessmann-Api/wiki/How-to-add-you-own-feature-to-the-api

Feel free to give me any feedback that could help or clarify the process.

Merci beaucoup @thetrueavatar! :1st_place_medal:

Iā€™ll try out the guide and give feedback (if needed).

Hi @thetrueavatar, Iā€™ve been toying around with your guide but Iā€™m a bit stuck. Shouldnā€™t be the first step be to update the Viessmann.Feature.php with the missing items that are found after running the getAvailableFeatures?

For example running the getAvailableFeatures gave me heating.compressor. In order to get the raw JSON data, this heating.compressor should be added to Viessmann.Feature.php in the form of const HEATING_COMRESSOR = "heating.compressor";. Then the raw JSON data can be obtained.

With that it is known what the properties, type and value, are. These can then be used to complete the getEntity method in your guide. At least that is what Iā€™m thinking at the moment.

In fact feature heating.compressor is an intermediate object that only define link to subfeature such as heating.compressor.0.something for instance. You have to reach the leaf to get the property value. For heating.compressors.0.statistics I have added the ā€œintermediateā€ feature ā€œheating.compressorā€ as constant in ViessmannApi but youā€™ll have to append circuitId and the statistics to it.

To help you to know if itā€™s a leaf feature you can do a getRawJsonData(ā€œheating.compressorā€) to see if there is any interesting value in the json or if it only contains subfeature links without properties/actions field

Btw I have added a bootstrap-dev.php that to help dev. It will include directory src instead of the phar, so you wonā€™t have to rebuild the phar on every change. Moreover, I have enable kind of debugging.