[VitoConnect] Getting readings from Viessmann Heating system via VitoConnect

It is working now.
I did not manage to read out the GetInstallationInformation. So my installationID was wrong.

Now I could read out the information.
To get the GetInstallationInformation I had to delete the entries in the bootstrap.php file (of course).
After that I could fill in the right InstallationInformation and add the entries again in the bootstrap.php.

Thank you for you help and the work of @thetrueavatar. The error message was pretty clear :slight_smile:
Have a nice day. Stay healthy.

1 Like

If you put only username/pwd and use the provided bootstrap then it will autodiscover installationId and gatewayId. However, since those value never change it’s an unnecessary request so I have added the possibility to optimize things by adding those value in credentials.properties. But both solution are supposed to work.

1 Like

@thetrueavatar merci beaucoup pour ce plugin formidable! And your quick response to the new developments…

Unfortunately I’m not able to get data with the latest version 1.3.2. ‘php bootstrap.php’ returns:
Message: Class 'Viessmann\API\DateTime' not found

I’m not that familiar with php, but a quick search reveals that there might be a need to replace DateTime with \DateTime here. Just wondering why this seems to happen only for me…

Oh, btw, I edited bootstrap.php by commenting out the readout of lines 3 and 4 of the credentials file (since it’s not working without those two lines, and I need to read them somehow in the first place)

Finally, I managed to clone the code and try to debug myself. Seems that changing DateTime to \DateTime in lines 82 and 83 did the job indeed. Unfortunately, I’m not familiar enough with git (yet) to create a pull-request myself…

My bad there was indeed a missing import…
Oh I hate those interpreted language. At least with compiled language import are being checked at compiled time…
I have made a 1.3.3 with this fix. However, this error only happens upon parsing reset limit date. This means you’re currently banned by viesmmann because you have done too much request…
You should get the gatewayId and installationId and add it to credentials.properties to reduce load.

1 Like

Great, thanks. Indeed, I was trying to get those ID, but was banned. Will try that today, limit should be reset now.

Another question: When I do the git checkout for 1.3.3, a lot of files are missing (e.g. in the vendor directory), compared to the develop branch. Is this intended and I’m using git in the wrong way, or should those file also be tagged?

Btw, is this the right place for such discussion or should we move somewhere else? Open a ticket on git?

This is a acutally a very good question.

In fact, the vendor directory contains only the third-party libraries.

It’s usually a good practice to not embed third-party library in our source code but to manage those with a dependency manager(here composer).

Before compiling the phar I have to install those dependencies managed by composer(through composer install).

However, in the develop branch, I have left those dependencies for people who would like to rebuild the phar themselve and are not used to manage dependencies with composer.

PS: In the future a ticket on git would be indeed more relevant as this could be seen by every user of the api not only the openhab one.

Hi there!

Ist there a way to get gas consumption data?

Hi community,

I have just installed OH 3.0.0 M2 and its additional Exec Binding and would like to get some values from my Viessmann heating system.
I have followed the example from @opus (many thanks) which works fine when i run in the php script getvalues.php in the Ubuntu command line i get values. But when using in de openhab script the function executeCommandLine(“php@@/etc/openhab2/scripts/GetValues.php”,5000) doesn’t seem to work. It seems that the arguments passed with the function is not in the correct order, some change’s in the 3.0.0 Binding?

I haven’t look into that bit with OH3, however note that OH3is using folders named openhab ( without the number!), are you sure with the selected folder?

Additionally, about executeCommandline read This.

As opus wrote the folder name has changed and the syntax of executeCommandLine has changed.

executeCommandLine(Duration.ofSeconds(5), "php", "/etc/openhab/scripts/GetValues.php")

should work.

1 Like

Thanks @opus and @NorbertHD!

Changed the folder name to openhab and the syntax of the executeCommandLine!
It works! but now get the authentication error…
Also when i run the GetValues.php script in the Ubuntu command line. Is this because the InstallationID and GatewayID is missing? I have 2 active Lan port on the Server.

Just put in the gatewayID and installationID but still the same error.

Please show your rule, because mine worked in OH3!

Used this DSL-type script and a cron trigger:

var result=executeCommandLine(Duration.ofSeconds(12), "php","/etc/openhab/scripts/GetValues.php")
    logInfo("GetValues_JSON", "result: {}",result)

P.S.: This thread gets rather long now, it would be better to start new questions in a new thread using VitoConnect as a tag!

Hi @opus

The executeCommandLine works well in OH3! But there is something wrong with the authentication when the php script is running. This has nothing to do with openhab but with the API.
Strange thing, when i run this php script in command line on a Ubuntu VM it works, when this script is executed on a physical Ubuntu server the authentication error occurs.

All I can say is that the script is working in OH2 and OH3 on a raspberry.
The problem you are observing is better reported toward script on github.

Hello, I don’t know how the exec works but credentials file location are defined in a relative path from the phar defined by the var DIR. Maybe that there are problem with this relative path when using exec ?
To debug things:

  1. Try to hardcode your credentials in the bootstrap.php in example. This will allow to check if there is a problem to read the credentials.properties.
$params = [
    "user" => "<username>",
    "pwd" => "<password>"),
    "installationId" =>"<installationId>"),
    "gatewayId" =>"<gatewayId>"),
    "deviceId" => "0",
    "circuitId" => "0"
  1. Enable more tracing by uncommenting the "Trace line "line in bootstrap.php. I should use a logger with loglevel for this but didn’t had the time till now. I could add a properties in “credentials.properties” to enable this kind of debug.
function print_exception($e){
    echo "Message: " . $e->getMessage() . "\n";
    echo "Code: " . $e->getCode() . "\n";
//    echo "Trace:" . $e->getTraceAsString() . "\n";

Hope this helps,Regards

1 Like

Hello, went back to a clean installation from the api (Viessmann-Api-1.4.0-SNAPSHOT.phar) and bootstrap.php. When executing on Ubuntu command line I get the error you can see in this attachment. Hope you can help me out!

When using the boostrap.php from the github I get the error “couldn’t find index.php”.

  1. Changed it to DIR./Viessmann/index.php
  2. Changed the user and password and defined it hardcoded (like you told)
    Still no authentication…

I think i couldn’t reach the authentication servers from Viessmann but how to check that?

@opus and @thetrueavatar

Solution: I had 2 network interfaces (NIC) one internal and one connected to the internet. Because there is no possibility to tell the API which NIC to choose (the one connected to the internet) there is a possibility on Ubuntu platform to modify the metric value of each network interface. This lower metric value the higher the IPv4 route priority. this metric value can be modified with the ifmetric package (ifmetric is a Linux tool for setting the metrics of all IPv4 routes attached to a given network interface at once. This may be used to change the priority of routing IPv4 traffic over the interface.Lower metrics correlate with higher priorities.)