[VitoConnect] Getting readings from Viessmann Heating system via VitoConnect

Hi,

sorry, I can not install the PHP or curl.
When I enter “sudo apt-get instal php” or “sudo apt-get install php-curl”
I get the message:
“Packet PHP-Curl cannot found”.

My system is a Raspberry with Linux Jessie.
Which repositories should be integrated in the /etc/apt/sources.list ?
Thank you.

Joe

Hi everyone, thanks for your great work. I am a noob. I followed your advise step by step. When I run “php GetValues.php” I receive HTML code. It looks like the Viessmann login page:


  • *
  •   <title>Viessmann Login</title>*
    
  •   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">*
    

Any ideas what could be the reason for this? I am running everything from my Openhab2 scripts folder as suggested in this thread.

Welcome to the openHAB forum!

Did you put your credentials into the credentials file?
Please show the contents of your “GetValues.php”.

Hi Jürgen,

yes, I entered my credentials in seperate lines in the credentials file.

This is the GetValues.php:

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

Looks OK to me.
Tried it on the command line myself and failed, however with other returns. I must be missing something, it is running from within openHAB.

Edit: Got my mistake, openhab is running under user openhab, when running from console I use another user!
Still looking for your case.

Which .phar file are you using, I’m still on the “old” snapshot version.
How did you install php? Using both installs as posted in the initial post?

Edit:
Changed to the actual “Viessmann-Api-1.1-SNAPSHOT.phar”, working for me!
However your GetValues has a single chartacter missing, the second line should read:

echo $viessmannApi->getOutsideTemperature();

you missed the “-”. However, that should have given a different result!

Hi Jürgen,

1000 Dank für Deine Hilfe!

I followed the installation instructions step by step. I did both installs and received no errors during the installation. I use the 1.1 Snaphot.
I also checked my GetValues.php. For some reason the “-” got lost when I copy pasted it into my message.

<?php include __DIR__.'/bootstrap.php';

echo $viessmannApi->getOutsideTemperature();

echo “@”;

echo $viessmannApi->getHotWaterStorageTemperature();

You wrote about the console. Should I run the php command from the Openhab console? I am currently simply logged in via SSH as user openhabian.

I guess the data I receive is the login page, not XML code. In earlier posts I read about a token. Do I have to generate one before my first login?

That is correct, however keep on mind which user you are then!
The token is handled by the API!

Using my files, with WRONG credentials will show: Error during authentication process. Please review your username/password. In other words, it’s not that.

Did you check if php is correctly installed? Using which php to show where it is installed and php -version to show which version.

Here are the results.

which php

/usr/bin/php

php -version

PHP 7.0.33-0+deb9u3 (cli) (built: Mar 8 2019 10:01:24) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.33-0+deb9u3, Copyright (c) 1999-2017, by Zend Technologies

Just like mine. Out of ideas :neutral_face:

I guess I got it. It might be a fundamental problem and I don’t know if it can be fixed or if I am able to use this solution at all.

I just read in your introduction that I need credentials for ViCare. I have a Vitovalor 300-P with a Vitocom LAN 3 module. I access my data using the Vitotrol App.

Could this be the problem?

Yes this is it. The solution used here is using the same connection as the ViCare App.
Not familiar with your Vitocom, but it sounds as if that one is communicating directly with your heating system, while ViCare is connecting via a cloud only :expressionless:

Hello
I’m noob on openHab.
I want to connect my ViCare app to my openhab with this tuto.
I use raspberrey 3b+ with openhabian
PHP7 and Curl correctly installed
VIESSMAN-API installed
Files bootstrap.php, credentials.properties and snapshot.phar copied in scripts folder
When i launch php command : i’ve php error

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

  • thrown in /etc/openhab2/scripts/getValues3.php on line 3*

My file ‘getValues3.php’ is :

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

my file ‘Bootstrap.php’ is

<?php
use Viessmann\API\ViessmannAPI;
use Viessmann\API\ViessmannApiException;
include 'phar://' . __DIR__ . '/Viessmann-Api-1.1-SNAPSHOT.phar/index.php';
$credentials = file(__DIR__ . "/credentials.properties");
$params = [
    "user" => trim("$credentials[0]"),
    "pwd" => trim("$credentials[1]"),
    "deviceId" => "0",
    "circuitId" => "0"
];
function print_exception($e){
    echo "Message: " . $e->getMessage() . "\n";
    echo "Code: " . $e->getCode() . "\n";
//    echo "Trace:" . $e->getTraceAsString() . "\n";
}
;

$errorHandler= function($e)
{
$currentException=$e;
do {
print_exception($currentException);
} while ($currentException = $currentException->getPrevious());
};
set_exception_handler($errorHandler);
try {
$viessmannApi = new ViessmannAPI($params);
} catch (ViessmannApiException $e) {
$errorHandler($e);
exit();
}
Please, if anyone see that i did wrong.
Thank you
LW

Welcome to the openHAB Forum!

Reading your post is hampered because you didn’t format the contents of your .PHP files, please edit that post.
If you just copied the bootstrap.php there is no need to show its contents.

As far as I can see, you did it all correct. I am not sure which version of the API file I’m using ( can’t verify ATM) but it is still working on my site.
Please confirm that you entered your user credentials for the ViCareApp into the credentials file.

Hello, I have just noticed there is a typo in your method call:
$viessmannApi->**;**getBoilerTemperature()
Please remove the ; between -> and getBoilerTemperature(). Php is then unable to understand on which object you’are trying to calle the method getBoilerTemperature() while it should be the objet ViessmannApi…

1 Like

Hi
I thank you for your two answer.
Sorry for indentation.

I try to reinstall completely the git .

Now, error is different

php GetBoilerTemperature.php

Message: Unable to get data for feature heating.boiler.sensors.temperature.main
Reason: Params Validation Error
Code: 1

I don’t modify the boostrap.php
I put my usr et pwd for Vicare in credentials.properties

I’ve a Vitodens with 2 circuits (GroundHeat and radiators)
Which parameters set in CIrcuitId and DeviceID.
I try different combination 1 - 2 or 3 but always the same error.
Thank you for your help.

Ludovic

Since you changed the setup, you’d better show the ACTUALLY used contents of your

GetBoilerTemperature.php

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

Hello, I didn’t implement (yet) any logger but you can increase error information by editing bootstrap.php. You just have to remove // from the line:
// echo “Trace:” . $e->getTraceAsString() . “\n”;
This would print more in depth information to ease debuging.

Just to warn you Viessmann server has been updated today with some small changes. I have already made the update in my API (in version 1.1-SNAPSHOT). Will wait a bit for feedback and then will do an official release.