项目作者: rb-cohen

项目描述 :
Hive home heating and smart devices PHP SDK
高级语言: PHP
项目地址: git://github.com/rb-cohen/php-hive-v6.git
创建时间: 2017-03-05T23:01:51Z
项目社区:https://github.com/rb-cohen/php-hive-v6

开源协议:MIT License

下载


php-hive-v6

Hive home heating and smart devices PHP SDK

Install

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

List devices

Using the CLI script

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

Using the SDK

  1. $authentication = new Credentials($username, $password);
  2. $client = new Client($authentication);
  3. $devices = new Devices($client);
  4. $list = $devices->all();

Control smart plug

Using the CLI script

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

Using the SDK

  1. $authentication = new Credentials($username, $password);
  2. $client = new Client($authentication);
  3. $plug = new SmartPlug($id, $client);
  4. $plug->on()
  5. ->apply();

Control colour bulb

Using the CLI script

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

Using the SDK

  1. $authentication = new Credentials($username, $password);
  2. $client = new Client($authentication);
  3. $bulb = new BulbColour($id, $client);
  4. $bulb->on()
  5. ->setBrightness(50)
  6. ->setColour('#ff0000')
  7. ->apply();