
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
yeelight-ts
Advanced tools
A TypeScript library for controlling Yeelight smart devices over your local network.
Author: Gurel Ben Shabat (https://github.com/gurelbs)
This package provides a robust TypeScript library for controlling Yeelight smart devices over your local network. It simplifies the process of device discovery and command transmission, leveraging Node.js and TypeScript for a type-safe, event-driven architecture.
Install the package via npm:
npm install yeelight-ts
Here's how to get started with the Yeelight TypeScript API Wrapper:
1. Project Setup:
Create a new project directory and initialize a Node.js project:
mkdir yeelight
cd yeelight
npm init -y
2. Install Dependencies:
Install the yeelight-ts library and a development server like nodemon (optional, but recommended for automatic code reloading):
npm install yeelight-ts
npm install -g nodemon
3. Create an Entry Point:
Create a file named index.ts and add the following code:
import { Yeelight } from "yeelight-ts";
const yeelight = new Yeelight();
const IP = "192.168.x.x"; // Change this to your Yeelight's IP address
yeelight.setBrightness(IP, 50); // Example: Set brightness (1-100)
// Other control commands (uncomment to use):
// yeelight.setPower(IP, 'on'); // Turn on the light
// yeelight.setColorTemperature(IP, 6500); // Set cooler white
// yeelight.setRGB(IP, 0xFF0000); // Set red color
// yeelight.setHSV(IP, 180, 100); // Set purple color
// yeelight.setName(IP, 'Living Room Lamp'); // Set device name
4. Run the Application:
Start the application using nodemon for automatic code reloading during development:
nodemon index.ts
The Yeelight class provides the following methods:
sendDiscovery(): Sends a discovery message to find Yeelight devices on the network.handleDiscoveryResponse(callback): Handles the discovery response from a Yeelight device and calls the provided callback function with the device information. (Refer to the source code for event-driven usage)sendCommand(ip, method, params): Sends a command to a Yeelight device with the specified IP address, method, and parameters. Returns a promise that resolves to the command result.setPower(ip, powerState, effect, duration): Sets the power state of a Yeelight device.setBrightness(ip, brightness): Sets the brightness of a Yeelight device.setColorTemperature(ip, temperature): Sets the color temperature of a Yeelight device.setRGB(ip, rgb): Sets the RGB color of a Yeelight device.setHSV(ip, hue, sat): Sets the HSV color of a Yeelight device.setName(ip, name): Sets the name of a Yeelight device.isInRange(value): Checks if a value is within the valid range (1-100).Note: This is a basic overview. Refer to the actual source code for detailed descriptions and parameter types.
yeelight, smart-home, home-automation, lighting, smart-lighting, typescript, nodejs, yeelight-control, ssdp, iot, internet-of-things, smart-bulbs, yeelight-sdk, led-control, typescript-api
FAQs
A TypeScript library for controlling Yeelight smart devices over your local network.
We found that yeelight-ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.