Yeelight
Control your Yeelight smart lighting devices directly from FaustBot. Create dynamic stream experiences with color changes, brightness control, and flow effects triggered by chat, events, or scripts.
Overview
FaustBot connects to Yeelight devices on your local network using the Yeelight LAN Control Protocol, providing comprehensive control over your smart lights:
Device Discovery
Automatically discover Yeelight devices on your network.
Power Control
Turn lights on/off or toggle their power state.
Brightness Control
Set brightness levels from 1% to 100%.
Color Control
Set colors using RGB values or hex codes.
Color Temperature
Adjust warm/cool white from 1700K to 6500K.
Flow Effects
Create custom color flow sequences and effects.
Setup
Enable LAN Control
Before FaustBot can control your Yeelight devices, you need to enable LAN Control in the Yeelight app:
Open Yeelight App
Open the Yeelight app on your mobile device and ensure your lights are connected to your Wi-Fi network.
Enable LAN Control
For each device you want to control, tap on the device, go to settings (gear icon), and enable LAN Control.
Discover Devices in FaustBot
In FaustBot, go to Yeelight in the sidebar. Click Discover to find all Yeelight devices with LAN Control enabled on your network.
Verify Devices
Once discovered, your Yeelight devices will appear in the device list. You can test control by clicking on a device to toggle it.
Network Requirements
Your computer running FaustBot must be on the same local network as your Yeelight devices. Ensure your firewall allows UDP broadcast on port 1982.
Triggers
Respond to events from your Yeelight devices:
Device Discovered A new Yeelight device was found on the networkDevice Connected Successfully connected to a Yeelight deviceDevice Disconnected Lost connection to a Yeelight deviceState Changed A device's power, brightness, or color changedFlow Completed A color flow sequence finishedEffects
Power Control
Set Power
Turn a light on or off.
Toggle
Toggle the current power state.
Light Control
Set Brightness
Set brightness (1-100%).
Set Color RGB
Set color using R, G, B values.
Set Color Hex
Set color using hex code.
Set Color Temperature
Set warm/cool white (Kelvin).
Flow Effects
Start Flow
Start a color flow sequence.
Stop Flow
Stop the current flow effect.
Scripting API
Control Yeelight devices programmatically from your scripts:
Device Discovery
# Discover Yeelight devices on the network
CPH.YeelightDiscover()
# Get list of all discovered devices
devices = CPH.YeelightGetDevices()
for device in devices:
CPH.Log(f"Found device: {device['name']} ({device['id']})")Power Control
# Turn a light on
CPH.YeelightSetPower("device-id", True)
# Turn a light off
CPH.YeelightSetPower("device-id", False)
# Toggle power state
CPH.YeelightToggle("device-id")Brightness and Color
# Set brightness (1-100)
CPH.YeelightSetBrightness("device-id", 75)
# Set color using RGB values (0-255)
CPH.YeelightSetColorRGB("device-id", 255, 128, 0)
# Set color using hex code
CPH.YeelightSetColorHex("device-id", "#FF8000")
# Set color temperature in Kelvin (1700-6500)
CPH.YeelightSetColorTemperature("device-id", 4000)Flow Effects
# Start a color flow effect
# Parameters: device ID, count (0 = infinite), action after flow, flow expression
# Flow expression format: duration, mode, value, brightness
# Mode: 1 = color (RGB), 2 = color temp, 7 = sleep
flow = "500,1,16711680,100,500,1,65280,100,500,1,255,100" # RGB cycle
CPH.YeelightStartFlow("device-id", 0, 0, flow)
# Stop the current flow
CPH.YeelightStopFlow("device-id")See the full API reference for all available Yeelight methods.