Skip to content

elberth90/yeelight-api-client

Repository files navigation

yeelight-api-client

Build Status Scrutinizer Code Quality

Yeelight-api-client is a PHP client that makes it easy to manage and handle Yeelight bulbs.

Installation

Installation is possible using Composer.

Then install the library:

composer require elberth90/yeelight-api-client

Getting started

Create YeelightClient instance

use Yeelight\YeelightClient;
$client = new \Yeelight\YeelightClient();

Search for bulbs in your local network

$bulbList = $client->search();

Once you have list of available bulbs, you can perform on each bulb some actions like for example getting property of each bulb

foreach ($bulbList as $bulb) {
    $promise = $bulb->getProp([\Yeelight\Bulb\BulbProperties::COLOR_TEMPERATURE]);
}

Each action performed on bulb return Promise, so you can perform on it then() or done() operation.

$promise->done(function (\Yeelight\Bulb\Response $response) {
    // do something with response
}, function (\Yeelight\Bulb\Exceptions\Exception $exception) {
    // log exception or whatever...
});

Full documentation for an API can be found here

Contributing

See CONTRIBUTING.md for more information about contributing and developing yeelight-api-client.