PHP code example of bentools / qivivo-php

1. Go to this page and download the library: Download bentools/qivivo-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bentools / qivivo-php example snippets


 
 $clientId = 'myClientId';
 $clientSecret = 'myClientSecret'; // To obtain those credentials, please contact Qivivo support.
 $qivivo = new \BenTools\Qivivo\Client(new \GuzzleHttp\Client(), $clientId, $clientSecret);
 
 
 // Retrieve main thermostat UUID
 $thermostatId = $qivivo->execute($qivivo->device()->getThermostatId());
 var_dump($thermostatId); // string "5dcb767f-d652-446a-a7d4-c8b22f77a7e8"
 
 
 // Retrieve current temperature
 var_dump($qivivo->execute($qivivo->thermostat()->getTemperature($thermostatId))); // float 19.7
 
 
 // Change temperature
 $qivivo->execute($qivivo->thermostat()->setTemperature($thermostatId, 21.5, 45)); // Sets the temperature to 21.5°C for 45 minutes
 

 composer