node-yeelight-wifi
"node-yeelight-wifi" is a node.js lib for controlling via wifi connected Yeelights.
It works with the RGBW bulbs, white bulbs and ceiling lights.
You need to activate "Lan control" on your lights. (see Troubleshooting)
Installation
npm install --save node-yeelight-wifi
Howto
Yeelight Lookup
You can lookup for yeelights in your local network like this:
const Lookup = Lookup; let look = ; look;
Methods
Once you have a Yeelight
(light
) object from a lookup you can use it like this:
setPower(power,duration)
Set the power of your Yeelight (on: true
, off: false
)
light;
setRGB(rgb,duration)
Set the RGB value (r: 0-255, g: 0-255, b: 0-255)
light;
setHSV(hsv,duration)
Set the HSV value (hue: 0-359, sat: 0-100, value/bright=0-100)
light;
setCT(hsv,duration)
Set the color temp value (1700 ~ 6500)
light;
setBright(brightness,duration)
Set the color brightness (0-100)
light;
updateState()
If you want to request a state (color,bright,power) update
light;
Yeelight
-Class (read only)
Usable (public) Members of light.power
(true
/false
)light.type
("unknown"
,"white"
,"color"
)light.bright
(0-100
)light.rgb
(example:{r: 0, g: 0, b: 0}
)light.hsb
(example:{h: 0, s: 0, b: 0}
)
Events
A Yeelight
instance has some events:
//socket connect and disconnect eventslight;light; //if the color or power state has changedlight; //if something went wronglight;
Examples
- see
examples/examples.js
Troubleshooting
- Yeelight is not detected?
- enable "LAN Control" on your yeelight
- https://www.yeelight.com/faqs/lan_control
Licence
Copyright (c) Bastian Karge
MIT (see License.md)