Light Control - bharat-1809/wizctl GitHub Wiki

Light Control

Control a single light by IP address.

final light = WizLight('192.168.1.100');

Reading state

final state = await light.getState();
// state.isOn, state.dimming, state.scene, state.temperature, state.r/g/b, state.speed

final config = await light.getSystemConfig();
// config.mac, config.moduleName, config.bulbClass, config.kelvinRange

Power

await light.turnOn();
await light.turnOn(brightness: 50);
await light.turnOff();
await light.toggle();
await light.setBrightness(75);

Color & temperature

await light.setColor(255, 100, 50);           // RGB
await light.setTemperature(3000);             // Kelvin
await light.setWarmWhite(200);                // Direct LED control (0-255)
await light.setColdWhite(150);

Scenes

Dynamic scenes support a speed parameter (10–200).

await light.setScene(WizScene.cozy);
await light.setScene(WizScene.ocean, speed: 150);
await light.setSpeed(120);                    // Change speed of current scene

System

await light.reboot();
await light.reset();    // Factory reset — use carefully
light.clearCache();     // Clear cached config

ControlSignal

Send multiple settings in one command:

await light.send(ControlSignal(state: true, dimming: 80, r: 255, g: 100, b: 50));

// Factory constructors
await light.send(ControlSignal.on());
await light.send(ControlSignal.rgb(255, 100, 50));
await light.send(ControlSignal.temperature(3000));
await light.send(ControlSignal.scene(WizScene.cozy));