Command.setPower constructor

Command.setPower({
  1. int? id,
  2. required String power,
  3. required String effect,
  4. required int duration,
  5. int? mode,
})

Command to switch on or off the device (main light).

  • power - only 'on' or 'off' values.
  • effect - same as in Command.setColorTemperature.
  • duration - same as in Command.setColorTemperature.
  • mode (optional)
    • 0 - normal turn on operation (default value)
    • 1 - turn on and switch to color temperature mode
    • 2 - turn on and switch to RGB mode
    • 3 - turn on and switch to HSV mode
    • 4 - turn on and switch to color flow mode
    • 5 - turn on and switch to Night light mode (ceiling light only).

Implementation

Command.setPower({
  this.id,
  required String power,
  required String effect,
  required int duration,
  int? mode,
})  : method = CommandMethods.setPower,
      parameters = <dynamic>[power, effect, duration, if (mode != null) mode];