Git Product home page Git Product logo

php-qivivoapi's Introduction

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.

php-qivivoapi's People

Contributors

kiboost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

cyrilopensource

php-qivivoapi's Issues

"authentification error" when calling "qivivoAPIv2.php"

hello,

I cannot get my previous php program to work. I receive an "authentification error" when I run the following code :


$qivivo_user="[email protected]";
$qivivo_pass="************";
require($_SERVER['DOCUMENT_ROOT'].'/qivivoAPIv2.php');
$_qivivo = new qivivoAPI($qivivo_user, $qivivo_pass);
if (isset($_qivivo->error)) echo $_qivivo->error;

my php version is :
PHP 7.4.3

needless to say that I checked the login and password (I even changed it to make sure it wasn't a mistake on may own)

Is there anything that might have change since last year ? (especially since they upgraded their platform)

thank you for your wonderful work, a true fan !

Cannot declare class qivivoAPI, because the name is already in use

Hello

I used to be a real fan of your previous achievment with Qivivo and I was delighted to realize you already had released a new version. Unfortunately I cannot manage to get this one work. The error I came accross is way beyond my ability to correct it in php.

php version is : PHP 7.4.10

here is the file I tried to get to work (I just omited the php tags at the beginning and the end )

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// require_once('qivivoAPI.php');
echo "1";
$qivivo_user="XXXXXXXXXXXXXXX";
$qivivo_pass="XXXXXXXXXXX";
require($_SERVER['DOCUMENT_ROOT'].'/qivivoAPIv2.php');
echo "2";
$_qivivo = new qivivoAPI($qivivo_user, $qivivo_pass);
if (isset($_qivivo->error)) echo $_qivivo->error;
echo "fini";

I tried with and without including the line :
require_once('qivivoAPI.php');

but I always get the same php error which is :

Fatal error: Cannot declare class qivivoAPI, because the name is already in use in /var/www/html/qivivoAPIv2.php on line 8

thank you

ways to get the heating duration and the user defined temperatures

Hello, this is not a bug report but actually 2 questions :

  1. on the COMAP web site in the user interface there is a [Statistiques] tabs with very interesting data. Among them the duration time of eating (per day, weeks,...). Do you know if there is a way to get this value ?

  2. is there a way to read the temperature settings ? (I can get the temperature of the sensor module, the temperature I am setting but not the ones that I programmed)

And again and above all thank you and congratulations for your amazing work !

Erreur température temporaire

Bonjour,
Cette instruction $tempOrder = $_qivivo->setTemperature(18, 60); retourne une erreur chez moi Warning: Undefined array key "result" in /volume1/script/class/comapAPI.php on line 390 et l'ordre temporaire ne se fait pas.
Je suis en monozone, un seul thermostat.
j'ai modifié la ligne 390 par if (isset($hasTimeOrder['result'])) qui fonctionne chez moi, plus d'erreur et l'instruction de chauffe temporaire est éffectuée.
idem ligne 452
Merci

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.