Skip to content

php API providing control over Smart Qivivo Thermostat

License

Notifications You must be signed in to change notification settings

KiboOst/php-qivivoAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 

Repository files navigation

php-qivivoAPI

php API for Smart Qivivo / Comap Thermostat

This php API allows you to control your Smart Qivivo / Comap Thermostat.

Jeedom user ? Check this Jeedom Plugin !

Use case example

  • Get your Qivivo/Comap data to trigger other actions.
  • Set a scenario in your smarthome (or trigger an url script) like "Going hollidays", to automatically change programs according to your scenario (working, hollidays, away).
  • Set your heating according to other weather sources (external Netatmo sensor, etc).
  • Set your heating if your interior camera recognize you.
  • As Qivivo/Comap doesn't support IFTTT yet, you can make your own trigger script!

This isn't an official API | USE AT YOUR OWN RISK!
This API is reverse-engineered, provided for research and development for interoperability.

Requirements
How-to
Connection
Reading datas
Changing datas
Version history

Requirements

  • PHP v5+
  • cURL (quite standard in PHP servers).
  • The API require internet access (it will authenticate against Qivivo/Comap servers).

How-to

  • Download class/comapAPI.php and put it on your server.

  • Include comapAPI.php in your script.

  • Start it with your Qivivo username/password. All function should return an array with 'result' or 'error'. So you can check for 'error' before getting 'result': if (!isset($answer['error']) ...

  • This API

Connection

require($_SERVER['DOCUMENT_ROOT'].'/path/to/comapAPI.php');
$_qivivo = new qivivoAPI($qivivo_user, $qivivo_pass);
if (isset($_qivivo->error)) echo $_qivivo->error;

Let the fun begin:

READING OPERATIONS

//get heating:
$heating = $_qivivo->getHeating();
echo "<pre>_____>heating:<br>".json_encode($heating, JSON_PRETTY_PRINT)."</pre><br>";

//get temperatures settings:
$settings = $_qivivo->getTempSettings();
echo "<pre>_____>settings:<br>".json_encode($settings, JSON_PRETTY_PRINT)."</pre><br>";

//get devices with info (serial number, firmware, etc.):
$getDevices = $_qivivo->getDevices();
echo "<pre>_____>getDevices:<br>".json_encode($getDevices['result'], JSON_PRETTY_PRINT)."</pre><br>";

//get array of serial=>devices with zone, current order etc:
$getFullDevices = $_qivivo->getFullDevices();
echo "<pre>_____>getFullDevices:<br>".json_encode($getFullDevices['result'], JSON_PRETTY_PRINT)."</pre><br>";

//get zones, with name, id, type, connected objects serials:
$getZones = $_qivivo->getZones();
echo "<pre>_____>getZones:<br>".json_encode($getZones, JSON_PRETTY_PRINT)."</pre><br>";

//get zone events (temporary_instruction, ...):
$getZoneEvents = $_qivivo->getZoneEvents('Chambres');
echo "<pre>_____>getZoneEvents:<br>".json_encode($getZoneEvents, JSON_PRETTY_PRINT)."</pre><br>";

//get name of current program:
$getCurrentProgram = $_qivivo->getCurrentProgram();
echo "<pre>_____>getCurrentProgram:<br>".json_encode($getCurrentProgram, JSON_PRETTY_PRINT)."</pre><br>";

//get all programs, with shedule id per zone:
$getPrograms = $_qivivo->getPrograms();
echo "<pre>_____>getPrograms:<br>".json_encode($getPrograms, JSON_PRETTY_PRINT)."</pre><br>";

//get all shedules, with days time slots:
$getSchedules = $_qivivo->getSchedules();
echo "<pre>_____>getSchedules:<br>".json_encode($getSchedules, JSON_PRETTY_PRINT)."</pre><br>";

//get weather:
$weather = $_qivivo->getWeather();
echo "<pre>_____>weather:<br>".json_encode($weather, JSON_PRETTY_PRINT)."</pre><br>";

//get zone events (temporary order, ...):
$getZoneEvents = $_qivivo->getZoneEvents('Chambres');
echo "<pre>_____>getZoneEvents:<br>".json_encode($getZoneEvents, JSON_PRETTY_PRINT)."</pre><br>";

//Does zone has temporary order:
$hasTimeOrder = $_qivivo->hasTimeOrder('Chambres');
echo "<pre>_____>hasTimeOrder:<br>".json_encode($hasTimeOrder, JSON_PRETTY_PRINT)."</pre><br>";

CHANGING OPERATIONS

//change heating:
$_qivivo->setHeating(true);

//set thermostat temperature (Second argument is duration in minutes, can be omitted default 120. Last argument not necessary if one thermostat only):
$_qivivo->setTemperature(15, 120, 'Salle');

//set zone mode (Second argument is duration in minutes):
//available modes are: 'stop', 'eco', 'comfort_minus2', 'comfort_minus1', 'comfort'
$_qivivo->setZoneMode('comfort_minus1', 120, 'Chambres');

//cancel zone order:
$_qivivo->cancelZoneOrder('Chambres');

//change running program:
$_qivivo->setProgram('Absence');

//change temperatures settings:
$settingsAr = array(
                    "away"=>15.5,
                    "frost_protection"=>12,
                    "night"=>17.5,
                    "connected"=>array(
                                    "presence_1"=>18,
                                    "presence_2"=>19,
                                    "presence_3"=>20,
                                    "presence_4"=>20.5
                                )
                );
$_qivivo->setTempSettings($settingsAr);

//set /cancel away:
$_qivivo->setAway();
$_qivivo->cancelAway();

//set / cancel departure:
$startDate = "2020-09-03T22:00:00.000Z";
$endDate = "2020-09-13T12:00:00.000Z";
$_qivivo->setDeparture($startDate, $endDate);
$_qivivo->cancelDeparture();

MULTI HOUSE SUPPORT

If you account has several homes, you can get an houseId and pass it to every function as kast argument. For example:

$homeId = $_qivivo->getHouseIdbyName('Beach Home');
$_qivivo->setHeating(true, $homeId);
$_qivivo->cancelAway($homeId);

Version history

v3.0 (2022-10-22)

  • Support multi house account.

v2.5 (2021-10-06)

  • Aligned with Jeedom plugin
  • API renamed comapAPI.php

v2.1 (2020-09-23)

  • Support monozone configurations

v2.02 (2020-09-11)

  • getZoneEvents()
  • hasTimeOrder()
  • cancelZoneOrder()

v2.0 (2020-09-07)

  • New v2 version for new Comap interface! Read the doc : Lot of changes in functions and returns. Less functions regarding programs as all is editable in Comap interface now!

v0.6 (2019-05-26)

  • Qivivo servers switch to Comap.

v0.5 (2018-12-27)

  • New: setZoneMode($zone, $mode)

v0.4 (2018-03-27)

  • fix for Qivivo https switch

v0.25 (2018-03-01)

  • New : getZoneMode()

v0.2 (2017-11-07)

  • New : setTemperature()
  • New : getSynthesis()
  • Change: getTemperatures() now return message

v0.1 (2017-11-07)

  • First public version!

License

The MIT License (MIT)

Copyright (c) 2020 KiboOst

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Releases

No releases published

Packages

 
 
 

Languages