An open API service indexing awesome lists of open source software.

https://github.com/itskenny0/yeelight-php

Tiny, dynamic class to control Yeelight WiFi bulbs
https://github.com/itskenny0/yeelight-php

php smarthome xiaomi yeelight

Last synced: 4 days ago
JSON representation

Tiny, dynamic class to control Yeelight WiFi bulbs

Awesome Lists containing this project

README

          

-> Yeelight-PHP <-

This is a tiny class to facilitate controlling the Yeelight WiFi bulbs by Xiaomi in PHP.

Function names are dynamic and respond to the API endpoints found in the Xiaomi docs:
https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf

No Composer or other crap - keep it minimal.
This script has no external dependencies other than some PHP 5.x version and the sockets extension.

Usage:

set_power("on"); // power on
$yee->set_rgb(0xFF0000); // color to red
$yee->set_bright(50); // brightness to 50%

$yee->commit(); // changes are not sent to the bulb before commit() is called

sleep(10);
$yee->set_rgb(0x00FF00)->set_bright(100)->commit(); // calls return the object for fast chaining of commands

$status = $yee->get_prop("power")->commit(); // get current status
print_r($status);

$yee->disconnect();