Giter Club home page Giter Club logo

Comments (18)

rogrun avatar rogrun commented on July 19, 2024

Hallo OMCastle,

ich möchte auch sehr gern den Warmwasserspeicher über das Script füllen. Hast du das hin bekommen?

Gruß rogrun

from viessmann-api.

thetrueavatar avatar thetrueavatar commented on July 19, 2024

Hello,
I'm not quite sure to understand what you want. Since version 1.0.1 all feature exposed by viessmann are exposed(in read and write). You'll find every method implemented on the api documentation here:
https://htmlpreview.github.io/?https://raw.githubusercontent.com/thetrueavatar/Viessmann-Api/develop/docs/class-Viessmann.API.ViessmannAPI.html

from viessmann-api.

rogrun avatar rogrun commented on July 19, 2024

Hello,

i want to charge my boiler once. But i don't know how to do this. Can you tell me which method i have tu use?

Thanks alot

from viessmann-api.

thetrueavatar avatar thetrueavatar commented on July 19, 2024

from viessmann-api.

rogrun avatar rogrun commented on July 19, 2024

I have found this Coder here: https://forum.fhem.de/index.php/topic,86073.195.html


#!/bin/bash
export CLIENTID=79742319e39245de5f91d15ff4cac2a8
export CLIENTSECRET=8ad97aceb92c5892e102b093c7c083fa
export TOKEN_EP=https://iam.viessmann.com/idp/v1/token
export AUTHZ_EP=https://iam.viessmann.com/idp/v1/authorize
export SCOPE=openid
export REDIRECTURI=vicare://oauth-callback/everest
export isiwebuserid=user
export isiwebpasswd=pw
CODE=curl -s -k --user "$isiwebuserid:$isiwebpasswd" "$AUTHZ_EP?client_id=$CLIENTID&scope=$SCOPE&redirect_uri=$REDIRECTURI&response_type=code"| grep -Eio 'code=(.)*"'| cut -c"6-" | sed 's/.$//'
#echo "CODE=$CODE"
TOKEN=curl -s -k --user "$CLIENTID:$CLIENTSECRET" -d "code=$CODE&grant_type=authorization_code&client_id=$CLIENTID&redirect_uri=$REDIRECTURI" $TOKEN_EP | sed 's/{"access_token":"//' | sed 's/".*//'
#REP_STATUS=curl -k -H "AUTHORIZATION: Bearer $TOKEN" "https://api.viessmann-platform.io/operational-data/installations/votre_numero/gateways/votre_numero/devices/0/features/heating.circuits.0.operating.modes.active?expanded=false&"
#echo "$REP_STATUS"
REP=curl -X POST https://api.viessmann-platform.io/operational-data/installations/xxxx/gateways/xxxxxxxxxx/devices/0/features/heating.dhw.oneTimeCharge/activate -S -s -H "Content-Type: application/json" -H "AUTHORIZATION: Bearer $TOKEN" -d '{"mode":"activate"}'
echo "$REP"


Is it possible to implement it in your API?

from viessmann-api.

rogrun avatar rogrun commented on July 19, 2024

Hello,

i have found a way to start the OneTimeCharge.
You only need to enable it with the "setRawJsonData" function as follows:

<?php
include __DIR__ . '/bootstrap.php';
$mode = "{\"mode\": \"activate\"}";

$viessmannApi->setRawJsonData("heating.dhw.oneTimeCharge", "activate", $mode);

And this code to deactivate:

<?php
include __DIR__ . '/bootstrap.php';
$mode = "{\"mode\": \"deactivate\"}";

$viessmannApi->setRawJsonData("heating.dhw.oneTimeCharge", "deactivate", $mode);

Best regards

from viessmann-api.

thetrueavatar avatar thetrueavatar commented on July 19, 2024

from viessmann-api.

thetrueavatar avatar thetrueavatar commented on July 19, 2024

from viessmann-api.

thetrueavatar avatar thetrueavatar commented on July 19, 2024

from viessmann-api.

rogrun avatar rogrun commented on July 19, 2024

Now i have it tested. The OneTimeCharge is starting on my heatingsystem, but i get this message in the browser:

Message: Return value of Viessmann\API\ViessmannAPI::startOneTimeDhwCharge() must be of the type string, null returned Code: 0

Here my code:

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

echo "OneTimeCharge is: ".$viessmannApi->isOneTimeDhwCharge();

The same message, when I'm stopping the OneTimeCharge:

Message: Return value of Viessmann\API\ViessmannAPI::stopOneTimeDhwCharge() must be of the type string, null returned Code: 0

Here are details from my heating:
Viessmann Vitodens 300-W B3HB
Viessmann Vitocell 100-W

from viessmann-api.

rogrun avatar rogrun commented on July 19, 2024

I think the code in ViessmannAPI should be:

public function isOneTimeDhwCharge(): bool
    {
        return $this->getEntity(ViessmannFeature::HEATING_DHW_ONETIMECHARGE)->getProperty("active")["value"];
    }

    public function startOneTimeDhwCharge()
    {
        $data = "{\"mode\": \"activate\"}";
        return $this->setRawJsonData(ViessmannFeature::HEATING_DHW_ONETIMECHARGE, "activate", $data);
    }

    public function stopOneTimeDhwCharge()
    {

        $data = "{\"mode\": \"deactivate\"}";
        return $this->setRawJsonData(ViessmannFeature::HEATING_DHW_ONETIMECHARGE, "deactivate", $data);
    }

But its not tested

from viessmann-api.

thetrueavatar avatar thetrueavatar commented on July 19, 2024

from viessmann-api.

rogrun avatar rogrun commented on July 19, 2024

Thank you for your great work. Now it works fine.
I took some changes in the example/StartOneTimeCharge.php

Here is my file to start:

<?php
include __DIR__.'/bootstrap.php';
$viessmannApi->startOneTimeDhwCharge();
sleep(1);
echo (int)$viessmannApi->isOneTimeDhwCharge();

I have add the sleep(1); for waiting a short time, so that the OneTimeCharge at my heating can start. After that waiting I get a response from API that the OneTimeCharge runs or not.

Best regards

from viessmann-api.

thetrueavatar avatar thetrueavatar commented on July 19, 2024

from viessmann-api.

shikousa avatar shikousa commented on July 19, 2024

Is the startOneTimeDhwCharge() working reliable? I'm not sure what the correct call is. In StartOneTimeCharge.php you call the startOneTimeDhwCharge() twice, whereas @rogrun calls it once, but has a delay of 1s before getting the status? Thanks.

from viessmann-api.

rogrun avatar rogrun commented on July 19, 2024

Hello, it is not nessesary to call it twice. In my use case, I call startOneTimeDhwCharge () once and wait a second to query whether it ran successfully.

I start OneTimeCharge in one PHP and query the status in another. This means that the methods are not executed via the cache.

Best regards

from viessmann-api.

shikousa avatar shikousa commented on July 19, 2024

Hello. I could also make startOneTimeDhwCharge() working now, but the script always returns 0. Even if I have a delay of 5s, it returns 0.

StartOneTimeCharge.php:

<?php
include __DIR__.'/bootstrap.php';
$viessmannApi->startOneTimeDhwCharge();
sleep(5);
echo (int)$viessmannApi->isOneTimeDhwCharge();

Once I call another script right after startOneTimeDhwCharge() to only get the status of isOneTimeDhwCharge() it is working.
Is there some kind of caching?

StatusOneTimeCharge.php

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

from viessmann-api.

rogrun avatar rogrun commented on July 19, 2024

Hello, you have to call the request in each single php, because since the API is limited from Viessmann-Server last year, all requests in this API are cached. So this Code will failed:

include DIR.'/bootstrap.php';
$viessmannApi->startOneTimeDhwCharge();
sleep(5);
echo (int)$viessmannApi->isOneTimeDhwCharge();

from viessmann-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.