Yeelight Python Library
raw JSON → 0.7.16 verified Mon Apr 27 auth: no python
A Python library for controlling YeeLight RGB bulbs over local network using the Yeelight WiFi LED light protocol. Version 0.7.16 supports Python >=3.4, with active maintenance. Release cadence is irregular.
pip install yeelight Common errors
error yeelight.Bulb('192.168.1.100').turn_on() ↓
cause Bulb is not discoverable or IP incorrect.
fix
Validate bulb IP and ensure LAN control enabled. Use
yeelight.discover_bulbs() to find bulbs. error yeelight.main.BulbException: Bulb did not respond ↓
cause Bulb unreachable, possibly due to firewall or bulb not supporting command.
fix
Check network connectivity, disable firewall for local network, and ensure bulb firmware supports the command.
Warnings
gotcha Bulb must be on network and not in 'lan control' disabled mode. Yeelight app has a setting 'LAN Control' that must be enabled for the library to work. ↓
fix Enable 'LAN Control' in Yeelight app under Settings -> LAN Control.
deprecated The 'music_mode' parameter and related methods are deprecated and may be removed in future versions. ↓
fix Avoid using music_mode; use standard commands.
Imports
- Bulb
from yeelight import Bulb - BulbException wrong
from yeelight import YeeLightExceptioncorrectfrom yeelight import BulbException
Quickstart
import yeelight
import os
bulb_ip = os.environ.get('BULB_IP', '192.168.1.100')
bulb = yeelight.Bulb(bulb_ip)
bulb.turn_on()
bulb.set_rgb(255, 0, 0)
bulb.set_brightness(50)