Skip to main content

A Python library for controlling YeeLight RGB bulbs.

Project description

Description

image

image

image

Documentation Status

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.

Installation

There are many ways to install yeelight:

  • With pip (preferred), run pip install yeelight.
  • With setuptools, run easy_install yeelight.
  • To install from source, download it from https://gitlab.com/stavros/python-yeelight and run python setup.py install.

Usage

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.

Contributing

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!

License

yeelight is distributed under the BSD license.

Changelog

v0.7.9 (2022-02-06)

Features

  • Implement async music mode (closes #73) [Alex]

v0.7.8 (2021-10-15)

Fixes

  • Use compact json commands. [J. Nick Koston]

  • Asyncio: Reconnect on protocol errors. [J. Nick Koston]

  • Reduce chance of overloading bulb. [J. Nick Koston]

v0.7.6 (2021-10-03)

Fixes

  • Remove writer workaround from #61 with asyncio. [J. Nick Koston]

v0.7.5 (2021-09-19)

Features

  • Improve model detection. [J. Nick Koston]

Fixes

  • Fix aio disconnect handling. [J. Nick Koston]

v0.7.4 (2021-08-26)

Features

  • Add support for setting capabilities from external discovery. [J. Nick Koston]

  • Add support for YLDD05YL aka strip6. [J. Nick Koston]

Fixes

  • Increase asyncio timeout to 15 seconds. [J. Nick Koston]

v0.7.2 (2021-08-07)

Fixes

  • Improve async handling on connection errors. [starkillerOG]

v0.7.0 (2021-08-04)

Features

  • Add asyncio support. [J. Nick Koston]

  • Add support for Yeelight GU10 dimmable (YLDP004) [Stavros Korokithakis]

Fixes

  • Update _last_properties more consistently. [starkillerOG]

v0.6.2 (2021-05-02)

Features

  • Add support for bslamp3, ceiling18, ceiling24, ct2, lamp1, strip2. [root]

  • Add support for ceila (YLXD76YL) [zvldz]

Fixes

  • Fix an infinite recursion issue. [Stavros Korokithakis]

  • Add support for strip4 (YLDD03YL) [zvldz]

v0.6.1 (2021-04-20)

Fixes

  • Add support for lamp15 (YLTD003) [Caleb Mah]

v0.6.0 (2021-04-12)

Features

  • 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]

Fixes

  • 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]

v0.5.4 (2020-10-08)

Features

  • Add update notification functionality (implements #4) [Xiaonan Shen]

  • Add manufacturer's default and other flows. [Stavros Korokithakis]

Fixes

  • Fix get_ip_address portability by using the ifaddr library. [Greg V]

  • Fix flow preset names. [Stavros Korokithakis]

v0.5.3 (2020-06-15)

Features

  • Add ct_bulb bulb type. [Stavros Korokithakis]

v0.5.1 (2020-02-14)

Features

  • Add get_known_models method. [Michał Ciemięga]

v0.5.0 (2019-04-15)

Features

  • Support the "set scene" API call. [Michał Ciemięga]

Fixes

  • 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]

v0.4.4 (2019-03-19)

Fixes

  • Ignore exception more specifically. [Stavros Korokithakis]

v0.4.3 (2018-09-06)

Fixes

  • Fix crash when trying to use BulbType early. [Stavros Korokithakis]

v0.4.1 (2018-06-25)

Features

  • 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]

v0.4.0 (2018-03-10)

Features

  • Add support for moonlight mode. [Stavros Korokithakis]

Fixes

  • Fix bulb type detection (#5) [Sebastian Muszynski]

v0.3.3 (2017-09-18)

Fixes

  • 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]

v0.3.2 (2017-06-20)

Fixes

  • Use enum-compat instead of enum34. [Stavros Korokithakis]

v0.3.0 (2017-05-10)

Features

  • Add additional presets. [Stavros Korokithakis]

v0.2.3 (2017-04-30)

Fixes

  • Allow toggling to update the local properties cache. [Stavros Korokithakis]

  • Force cache population when activating music mode. [Teemu R]

v0.2.2 (2017-02-10)

Fixes

  • Pass 0 for the port number in music mode so the OS picks a port at random. [Stavros Korokithakis]

v0.2.0 (2017-01-19)

Features

  • Add discovery (closes #3). [Stavros Korokithakis]

v0.1.0 (2017-01-16)

Fixes

  • Abort with an error if the bulb closes the connection (fixes #5). [Stavros Korokithakis]

  • Flow API improvements (#3) [Teemu R]

v0.0.13 (2017-01-11)

Changes

  • Add changelog. [Stavros Korokithakis]

Fixes

  • Make ensure_on more accurate by always fetching the properties before a method call. [Stavros Korokithakis]

v0.0.12 (2016-11-16)

Fixes

  • Remove debugging command that was erroneously left in. [Stavros Korokithakis]

v0.0.11 (2016-11-16)

Features

  • Add music mode. [Stavros Korokithakis]

v0.0.10 (2016-11-15)

Features

  • Add set_adjust. [Stavros Korokithakis]

  • Add value parameter to set_hsv. [Stavros Korokithakis]

Fixes

  • Don't require flake8 for tests any more. [Stavros Korokithakis]

  • Fix tests on Python 3. [Stavros Korokithakis]

  • Fix per-call effects. [Stavros Korokithakis]

v0.0.9 (2016-11-14)

Fixes

  • Ignore errors on init files. [Stavros Korokithakis]

v0.0.8 (2016-11-14)

Fixes

  • Hopefully actually fix version string problem during setup. [Stavros Korokithakis]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yeelight-0.7.9.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

yeelight-0.7.9-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

Details for the file yeelight-0.7.9.tar.gz.

File metadata

  • Download URL: yeelight-0.7.9.tar.gz
  • Upload date:
  • Size: 54.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for yeelight-0.7.9.tar.gz
Algorithm Hash digest
SHA256 69970e72e9a0c8fbc6cf17f5ad9666a743b05df9eddc07dda500e08bd8d3c601
MD5 6dc8e6dba439ef6eb3e8257cc7e877fd
BLAKE2b-256 b470c65a115750c17c3d78e1108d0c58ca4c774572ed953a3bd84b11425a418f

See more details on using hashes here.

File details

Details for the file yeelight-0.7.9-py3-none-any.whl.

File metadata

  • Download URL: yeelight-0.7.9-py3-none-any.whl
  • Upload date:
  • Size: 38.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for yeelight-0.7.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c077b3956f2766c7096f29709c045424f61af1b17f0f059ce24a7f71128bfa51
MD5 c3634ccc71d52a5603d0b05736e1b044
BLAKE2b-256 cd2347b2c0bf1cb62b633f1b3ad8710d0cdfec9c5cbe67fc5604c9f2d02f3678

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page