A simple Node.js library to discover and control Xiaomi Yeelights over LAN.
This solution offers a 1:1 implementation of the official docs from Xiaomi, and also includes an SSDP implementation to retrieve the IP of your light.
# Run this in your favourite terminalnpm i yeelight-node
You can get started by running the example, which will discover and ping your lights over LAN:
In your code, simply require and instantiate the package as a class, passing in the IP address and port of the light as an object.
const Yeelight =const yeelight = ip: '0.0.0.0' port: 55443yeelightyeelightyeelight
If you don't know the IP of your light, you can use the SSDP client to scan your network:
const Client =const client =client
You can now call any of the operations from the official docs on this instance.
⚠️ Make sure you enabled the LAN Control option in the Yeelight app.
Original work by @cpav3.