Loading...
Loading...
Compare original and translation side by side
"What is the IP address of your Wiz light?" or "Where is your Wiz light located?" or "What IP does your Wiz light use?"
"你的Wiz灯的IP地址是什么?" 或 "你的Wiz灯位于哪里?" 或 "你的Wiz灯使用什么IP?"
undefinedundefinedundefinedundefinedpackage.jsonnpm init -y"type": "module"wiz-lightnode-cronpackage.jsonnpm init -y"type": "module"wiz-lightnode-cronimport { WizLight } from 'wiz-light';
// Create instance with IP and port (IP must be provided)
const wl = new WizLight('192.168.1.2', { port: 38899 });
// Turn light ON
await wl.setLightStatus(true);
// Turn light OFF
await wl.setLightStatus(false);
// Set properties
await wl.setLightProps({
r: 0,
g: 255,
b: 0,
c: 0,
w: 100,
dimming: 100
});
// Get current status
const status = await wl.getStatus();
console.log(status.result);import { WizLight } from 'wiz-light';
// 使用IP和端口创建实例(必须提供IP)
const wl = new WizLight('192.168.1.2', { port: 38899 });
// 打开灯光
await wl.setLightStatus(true);
// 关闭灯光
await wl.setLightStatus(false);
// 设置属性
await wl.setLightProps({
r: 0,
g: 255,
b: 0,
c: 0,
w: 100,
dimming: 100
});
// 获取当前状态
const status = await wl.getStatus();
console.log(status.result);setLightProps()wcw: 100c: 0c: 100w: 0setLightProps()wcw: 100c: 0c: 100w: 0const wl = new WizLight('192.168.1.2', {
// Port number (default: 38899)
port: 38899,
// Time to wait before retrying in ms (default: 1000)
statusCheckTimeout: 1000,
// Number of retry attempts (default: 5)
retryTimes: 5
});const wl = new WizLight('192.168.1.2', {
// 端口号(默认:38899)
port: 38899,
// 重试前等待时间(毫秒,默认:1000)
statusCheckTimeout: 1000,
// 重试次数(默认:5)
retryTimes: 5
});node-cronimport { WizLight } from 'wiz-light';
import cron from 'node-cron';
const wl = new WizLight('192.168.1.2', { port: 38899 });
// Schedule light to turn ON every day at 6:00 AM
cron.schedule('0 6 * * *', async () => {
await wl.setLightStatus(true);
});
// Schedule light to turn OFF every day at 10:00 PM
cron.schedule('0 22 * * *', async () => {
await wl.setLightStatus(false);
});node-cronimport { WizLight } from 'wiz-light';
import cron from 'node-cron';
const wl = new WizLight('192.168.1.2', { port: 38899 });
// 调度灯光每天早上6点打开
cron.schedule('0 6 * * *', async () => {
await wl.setLightStatus(true);
});
// 调度灯光每天晚上10点关闭
cron.schedule('0 22 * * *', async () => {
await wl.setLightStatus(false);
});scripts/light-on.jsscripts/light-off.jsscripts/light-color.jsscripts/light-status.jsscripts/light-on.jsscripts/light-off.jsscripts/light-color.jsscripts/light-status.jsundefinedundefined
**CRITICAL:**
- IP address is REQUIRED for all scripts
- Port is optional (default: 38899)
- Scripts MUST be run from the skill's directory (where package.json and scripts folder are located)
**关键提示:**
- 所有脚本都需要IP地址
- 端口为可选(默认:38899)
- 脚本必须从技能目录(包含package.json和scripts文件夹的位置)运行package.jsonnpm init -y"type": "module"wiz-lightnode-cronpackage.jsonnpm init -y"type": "module"wiz-lightnode-cron