emiliopedrollo / yeelight-api-client
Client library for Yeelight API
dev-master
2023-04-19 21:59 UTC
Requires
- php: >=7.4.0
- ext-json: *
- clue/socket-raw: ^1.6
- react/promise: ^2.9
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpspec/prophecy: ^1.17
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2024-10-20 01:13:38 UTC
README
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.