A Python library for controlling YeeLight RGB bulbs.
yeelight
is a simple Python library that allows you to control YeeLight WiFi RGB LED
bulbs through your LAN.
For a command-line utility that uses this library, see yeecli.
There are many ways to install yeelight
:
pip install yeelight
.easy_install yeelight
.python setup.py install
.To use yeelight
, first enable "development mode" on your bulb
through the YeeLight app. Then, just import the library into your
project like so:
>>> from yeelight import Bulb
Afterwards, instantiate a bulb:
>>> bulb = Bulb("192.168.0.5")
>>> bulb.turn_on()
That's it!
Refer to the rest of the documentation for more details.
The library also contains a (currently undocumented) asyncio interface.
See the documentation for a list of supported devices.
If you'd like to contribute to the code, thank you! To install the various libraries required, run (preferably in a virtualenv):
$ pip install -Ur requirements_dev.txt
In order for your MR to pass CI, it needs to be checked by various utilities, which are managed by [pre-commit]{.title-ref}. [pre-commit]{.title-ref} will be installed by the above command, but you also need to install the pre-commit hook:
$ pre-commit install
The hook will run on commit. To run it manually (e.g. if you've already committed but forgot to run it, just run):
$ pre-commit run -a
Thanks again!
yeelight
is distributed under the BSD license.
Add support for MJDPL04YL (color5) [Andrea Ghensi]
Modernize PEP517 build. [Michał Górny]
Add "Tea Time" effect. [Daniel Rheinbay]
Use compact json commands. [J. Nick Koston]
Asyncio: Reconnect on protocol errors. [J. Nick Koston]
Reduce chance of overloading bulb. [J. Nick Koston]
Add support for setting capabilities from external discovery. [J. Nick Koston]
Add support for YLDD05YL aka strip6. [J. Nick Koston]
Add asyncio support. [J. Nick Koston]
Add support for Yeelight GU10 dimmable (YLDP004) [Stavros Korokithakis]
Add support for bslamp3, ceiling18, ceiling24, ct2, lamp1, strip2. [root]
Add support for ceila (YLXD76YL) [zvldz]
Fix an infinite recursion issue. [Stavros Korokithakis]
Add support for strip4 (YLDD03YL) [zvldz]
Add lamp4. [Stavros Korokithakis]
Add SSDP fallback to the get_props method. [Johnnie Ho]
Drop support for anything less than Python 3.4 (including 2.x) [Stavros Korokithakis]
Add the color4 bulb specs (closes #60) [Stavros Korokithakis]
Add Yeelight XianYu C2001 Ceiling Light (C2001C550) specs. [Sebastian Muszynski]
Add Yeelight Crystal Pendant Light (Meteorite, YLDL01YL) specs. [Sebastian Muszynski]
Add ceiling6 (YLXD08YL) and ceiling19 (YLXD49YL) specs. [Юрий Аузинь]
Add ceiling15 (YLXD42YL) specs. [Stavros Korokithakis]
Send a space in a new packet, to work around "Connection closed" errors. [Stavros Korokithakis]
Send newline in new packet, as some version bulbs expect that. [Stavros Korokithakis]
Add update notification functionality (implements #4) [Xiaonan Shen]
Add manufacturer's default and other flows. [Stavros Korokithakis]
Fix get_ip_address portability by using the ifaddr library. [Greg V]
Fix flow preset names. [Stavros Korokithakis]
Obey model's min/max when setting the bulb's color temperature. [Stavros Korokithakis]
Add night light support to ceiling1 and ceiling2. [Stavros Korokithakis]
Fix the color temperature of the ceiling light. [Stavros Korokithakis]
Provide individual color temperature range per model (#7) [Sebastian Muszynski]
Add WhiteTemp BulbType (#8) [quthla]
Allow multicast interface selection in discover_bulbs() (#6) [Luca Zorzi]
Make the requested properties a parameter of get_properties() and remove flow_params by default. [Stavros Korokithakis]
Set additional socket options to properly call multicast (#4) [filozof71]
Allow toggling to update the local properties cache. [Stavros Korokithakis]
Force cache population when activating music mode. [Teemu R]
Abort with an error if the bulb closes the connection (fixes #5). [Stavros Korokithakis]
Flow API improvements (#3) [Teemu R]
ensure_on
more accurate by always fetching the properties before a method call. [Stavros Korokithakis]Add set_adjust. [Stavros Korokithakis]
Add value parameter to set_hsv. [Stavros Korokithakis]
Don't require flake8 for tests any more. [Stavros Korokithakis]
Fix tests on Python 3. [Stavros Korokithakis]
Fix per-call effects. [Stavros Korokithakis]