Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
node-yeelight-wifi
Advanced tools
Readme
"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)
npm install --save node-yeelight-wifi
You can lookup for yeelights in your local network like this:
const Lookup = require("node-yeelight-wifi").Lookup;
let look = new Lookup();
look.on("detected",(light) =>
{
console.log("new yeelight detected: id="+light.id + " name="+light.name);
});
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.setPower(true).then(() =>
{
console.log("success");
}).catch((error =>
{
console.log("failed",error);
}));
setRGB(rgb,duration)
Set the RGB value (r: 0-255, g: 0-255, b: 0-255)
light.setRGB([255,255,0]).then(() =>
{
console.log("success");
}).catch((error =>
{
console.log("failed",error);
}));
setHSV(hsv,duration)
Set the HSV value (hue: 0-359, sat: 0-100, value/bright=0-100)
light.setRGB([180,70,100]).then(() =>
{
console.log("success");
}).catch((error =>
{
console.log("failed",error);
}));
setCT(hsv,duration)
Set the color temp value (1700 ~ 6500)
light.setCT(5000).then(() =>
{
console.log("success");
}).catch((error =>
{
console.log("failed",error);
}));
setBright(brightness,duration)
Set the color brightness (0-100)
light.setBright(80).then(() =>
{
console.log("success");
}).catch((error =>
{
console.log("failed",error);
}));
updateState()
If you want to request a state (color,bright,power) update
light.updateState().then(() =>
{
console.log("success");
console.log(light.rgb);
}).catch((error =>
{
console.log("failed",error);
}));
Yeelight
-Class (read only)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}
)A Yeelight
instance has some events:
//socket connect and disconnect events
light.on("connected",() =>{ console.log("connected"); });
light.on("disconnected",() => { console.log("disconnected"); });
//if the color or power state has changed
light.on("stateUpdate",(light) => { console.log(light.rgb); });
//if something went wrong
light.on("failed",(error) => { console.log(error); });
examples/examples.js
Copyright (c) Bastian Karge
MIT (see License.md)
FAQs
node js lib for yeelight bulbs
The npm package node-yeelight-wifi receives a total of 3 weekly downloads. As such, node-yeelight-wifi popularity was classified as not popular.
We found that node-yeelight-wifi 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.