rb-cohen/php-hive-v6

使用v6 API控制Hive的PHP SDK

dev-master 2017-03-30 22:03 UTC

This package is not auto-updated.

Last update: 2024-09-15 02:46:49 UTC


README

Hive家庭供暖和智能设备PHP SDK

安装

$ composer require rb-cohen/php-hive-v6:dev-master

列出设备

使用CLI脚本

$ php bin/devices.php --username test@test.com --password 12345

使用SDK

$authentication = new Credentials($username, $password);
$client = new Client($authentication);

$devices = new Devices($client);
$list = $devices->all();

控制智能插座

使用CLI脚本

$ php bin/smartPlug.php --username test@test.com --password 12345 --id <id> --on

使用SDK

$authentication = new Credentials($username, $password);
$client = new Client($authentication);

$plug = new SmartPlug($id, $client);
$plug->on()
     ->apply();

控制彩色灯泡

使用CLI脚本

$ php bin/bulb.php --username test@test.com --password 12345 --id <id> --brightness 50 --colour rgb(255, 221, 211) --on

使用SDK

$authentication = new Credentials($username, $password);
$client = new Client($authentication);

$bulb = new BulbColour($id, $client);
$bulb->on()
     ->setBrightness(50)
     ->setColour('#ff0000')
     ->apply();