bentools/qivivo-php

Qivivo 热水器 API 的非官方 PHP 客户端

v0.1 2016-12-07 10:27 UTC

This package is auto-updated.

Last update: 2024-09-14 23:50:01 UTC


README

安装

composer require bentools/qivivo-php

用法

<?php
$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

贡献

这是一个 Qivivo API 的早期草稿。欢迎贡献并添加一些测试。

许可协议

MIT