Command.setScene constructor

Command.setScene({
  1. int? id,
  2. required String cls,
  3. required int val1,
  4. required int val2,
  5. String? val3,
})

Command to set the device directly to specified state. If the device is off, it will turn the device on and then apply this command (main light).

  • cls (class)
    • 'color' - change the device to specified color and brightness
    • 'hsv' - change the device to specified color and brightness.
    • 'ct' - change the device to specified ct and brightness.
    • 'cf' - start a color flow in specified style.
    • 'auto_delay_off' - turn on the device to specified brightness and start a timer to turn off the light after specified number of minutes.
  • val1, val2, val3 - class specific values.

Implementation

Command.setScene({
  this.id,
  required String cls,
  required int val1,
  required int val2,
  String? val3,
})  : method = CommandMethods.setScene,
      parameters = <dynamic>[
        cls,
        val1,
        val2,
        if (val3 != null)
          if (cls == const SceneClass.hsv().value)
            int.tryParse(val3)
          else
            val3,
      ];