Command class

Commands are sent by CommandSender to control Yeelight device.

  • id - integer filled by message sender. It will be echoed back in response message. This is to help request sender to correlate request and response. If no id is provided, hashCode is used as id.
  • method - specifies which control method should be invoked. See CommandMethods.
  • parameters - list of parameters, method specific.

NOTE: 'bg' methods are used to control background light. These commands are only supported on lights that are equipped with a background light.

Constructors

Command(int? id, String method, List parameters)
Command.adjustBrightness({int? id, required int percentage, required int duration})
Command to adjust the brightness by specified percentage within specified duration.
Command.adjustColor({int? id, required int percentage, required int duration})
Command to adjust the color within specified duration.
Command.adjustColorTemperature({int? id, required int percentage, required int duration})
Command to adjust the color temperature by specified percentage within specified duration.
Command.bgAdjustBrightness({int? id, required int percentage, required int duration})
Command to adjust the brightness by specified percentage within specified duration (background light).
Command.bgAdjustColor({int? id, required int percentage, required int duration})
Command to adjust the color within specified duration (background light).
Command.bgAdjustColorTemperature({int? id, required int percentage, required int duration})
Command to adjust the color temperature by specified percentage within specified duration (background light).
Command.bgSetAdjust({int? id, required String action, required String property})
Command to change brightness, color temperature or color without knowing current value (background light).
Command.bgSetBrightness({int? id, required int brightness, required String effect, required int duration})
Command to set brightness of the background light.
Command.bgSetColorTemperature({int? id, required int colorTemperature, required String effect, required int duration})
Command to set color temperature of the background light.
Command.bgSetDefault({int? id})
Command to save current state of background light to persistent memory.
Command.bgSetHSV({int? id, required int hue, required int saturation, required String effect, required int duration})
Command to set color of the background light.
Command.bgSetPower({int? id, required String power, required String effect, required int duration, int? mode})
Command to switch on or off the background light.
Command.bgSetRGB({int? id, required int rgb, required String effect, required int duration})
Command to set color of the background light.
Command.bgSetScene({int? id, required String cls, required int val1, required int val2, String? val3})
Command to set the background light directly to specified state.
Command.bgStartColorFlow({int? id, required int count, required int action, required String flowExpression})
Command to start a color flow (background light).
Command.bgStopColorFlow({int? id})
Command to stop a running color flow (background light).
Command.bgToggle({int? id})
Command to toggle the background light.
Command.cronAdd({int? id, int type = 0, required int value})
Command to start a timer job on the device.
Command.cronDelete({int? id, int type = 0})
Command to stop the specific cron job.
Command.cronGet({int? id, int type = 0})
Command to retrieve the settings for the current cron job of the specified type.
Command.devToggle({int? id})
Command to toggle the main and background light at the same time.
Command.getProp({int? id, required List parameters})
Command to retrieve current property of the device.
Command.setAdjust({int? id, required String action, required String property})
Command to change brightness, color temperature or color without knowing current value (main light).
Command.setBrightness({int? id, required int brightness, required String effect, required int duration})
Command to set brightness of the device (main light).
Command.setColorTemperature({int? id, required int colorTemperature, required String effect, required int duration})
Command to set color temperature of the device (main light).
Command.setDefault({int? id})
Command to save current state of main light to persistent memory.
Command.setHSV({int? id, required int hue, required int saturation, required String effect, required int duration})
Command to set color of the device (main light).
Command.setMusic({int? id, required int action, required String host, required int port})
Command to start or stop music mode (main light).
Command.setName({int? id, required String name})
Command to set name for the device. The name will be stored on the device and reported in discovery response.
Command.setPower({int? id, required String power, required String effect, required int duration, int? mode})
Command to switch on or off the device (main light).
Command.setRGB({int? id, required int rgb, required String effect, required int duration})
Command to set color of the device (main light).
Command.setScene({int? id, required String cls, required int val1, required int val2, 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).
Command.startColorFlow({int? id, required int count, required int action, required String flowExpression})
Command to start a color flow (main light).
Command.stopColorFlow({int? id})
Command to stop a running color flow.
Command.toggle({int? id})
Command to toggle the device (main light).

Properties

hashCode int
The hash code for this object.
no setteroverride
id int?
getter/setter pair
message String
Command message. Used when sending command.
no setter
method String
final
parameters List
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override