public static class CapabilityLevel.SetLevelOnOff extends CapabilityLevel.LevelCommand
Capability.sendResourceCommand(buzz.getcoco.iot.Command<T>, buzz.getcoco.iot.Capability.CommandStatusListener<T>) to set level to desired value.
It can also turn off the resource if CapabilityLevel.LevelCommand.levelPct is set to Zero.
And turns on the resource if CapabilityLevel.LevelCommand.levelPct is greater than zero.
SetLevelOnOff command = new SetLevelOnOff(true);
command.levelPct = 0;
capabilityOnOff
.sendResourceCommand(
command,
(commandResponse, thr) -> {
if (thr != null){
// success case.
}
});
Let's assume that initially the bulb is at brightness level 70. After sending above command the bulb will be turned off as level is set to zero.
Command.State| Modifier and Type | Field and Description |
|---|---|
boolean |
restoreLevel
Flag indicating whether to set the resource back to its previous level.
|
levelPct, transitionTime, useDefaultTransitionTime| Constructor and Description |
|---|
SetLevelOnOff(boolean useDefaultTransitionTime)
Constructor with a param.
|
getCommandId, getTimeout, setCommandId, setTimeout, toJsonObject, toString@SerializedName(value="restoreLevelFlag") public boolean restoreLevel
CapabilityLevel.LevelCommand.levelPct is optional when this is specified