PHP code example of elberth90 / yeelight-api-client

1. Go to this page and download the library: Download elberth90/yeelight-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elberth90 / yeelight-api-client example snippets


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

$bulbList = $client->search();

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

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