[VitoConnect] Getting readings from Viessmann Heating system via VitoConnect

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.)