# OnOffCommands

# OnOffCommands


```
@Generated(value = ["GoogleHomePlatformCodegen"])
interface OnOffCommands
```

<br />

Known direct subclasses [OnOff](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff)

|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff` | API for the OnOff trait. |

*** ** * ** ***

Commands for the OnOff trait.

## Summary

| ### Public functions |
|---|---|
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#off()()` Turn off the device, and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to false. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#offBatchable()()` The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#off()` command. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#offWithEffect(com.google.home.matter.standard.OnOffTrait.EffectIdentifierEnum,kotlin.UByte)( effectIdentifier: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.EffectIdentifierEnum, effectVariant: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-byte/index.html )` Allow devices to be turned off using enhanced ways of fading. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#offWithEffectBatchable(com.google.home.matter.standard.OnOffTrait.EffectIdentifierEnum,kotlin.UByte)( effectIdentifier: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.EffectIdentifierEnum, effectVariant: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-byte/index.html )` The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#offWithEffect(com.google.home.matter.standard.OnOffTrait.EffectIdentifierEnum,kotlin.UByte)` command. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#on()()` Turn on the device, and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to true. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onBatchable()()` The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#on()` command. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithRecallGlobalScene()()` Allow the recall of the settings (global scene) the device had when the device was turned off. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithRecallGlobalSceneBatchable()()` The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithRecallGlobalScene()` command. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithTimedOff(com.google.home.matter.standard.OnOffTrait.OnOffControlBitmap,kotlin.UShort,kotlin.UShort)( onOffControl: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnOffControlBitmap, onTime: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html, offWaitTime: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html )` Allow the device to be turned on for a specific duration with a guarded off duration so that, should the device be subsequently turned off, further `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnWithTimedOffCommand.Request` commands received during this time are prevented from turning the devices back on. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithTimedOffBatchable(com.google.home.matter.standard.OnOffTrait.OnOffControlBitmap,kotlin.UShort,kotlin.UShort)( onOffControl: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnOffControlBitmap, onTime: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html, offWaitTime: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html )` The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithTimedOff(com.google.home.matter.standard.OnOffTrait.OnOffControlBitmap,kotlin.UShort,kotlin.UShort)` command. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#toggle()()` If the device is off, turn the device on and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to `true`. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#toggleBatchable()()` The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#toggle()` command. |

## Public functions

### off

```
suspend fun off(): Unit
```

Turn off the device, and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to false.

### offBatchable

```
fun offBatchable(): BatchableCommand<Unit>
```

The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#off()` command.

Turn off the device, and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to false.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | BatchableCommand |

### offWithEffect

```
suspend fun offWithEffect(
    effectIdentifier: OnOffTrait.EffectIdentifierEnum,
    effectVariant: UByte
): Unit
```

Allow devices to be turned off using enhanced ways of fading.

| Parameters |
|---|---|
| `effectIdentifier: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.EffectIdentifierEnum` | The fading effect to use when turning the device off. Must be a value from `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.EffectIdentifierEnum`. |
| `effectVariant: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-byte/index.html` | Variant of the effect, indicated by the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#offWithEffect(com.google.home.matter.standard.OnOffTrait.EffectIdentifierEnum,kotlin.UByte)` parameter, that is triggered. This must be one of the values in `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.DelayedAllOffEffectVariantEnum` or `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.DyingLightEffectVariantEnum` that correspond to the effect specified for `effectIdentifier`. |

### offWithEffectBatchable

```
fun offWithEffectBatchable(
    effectIdentifier: OnOffTrait.EffectIdentifierEnum,
    effectVariant: UByte
): BatchableCommand<Unit>
```

The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#offWithEffect(com.google.home.matter.standard.OnOffTrait.EffectIdentifierEnum,kotlin.UByte)` command.

Allow devices to be turned off using enhanced ways of fading.

| Parameters |
|---|---|
| `effectIdentifier: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.EffectIdentifierEnum` | The fading effect to use when turning the device off. Must be a value from `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.EffectIdentifierEnum`. |
| `effectVariant: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-byte/index.html` | Variant of the effect, indicated by the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#offWithEffectBatchable(com.google.home.matter.standard.OnOffTrait.EffectIdentifierEnum,kotlin.UByte)` parameter, that is triggered. This must be one of the values in `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.DelayedAllOffEffectVariantEnum` or `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.DyingLightEffectVariantEnum` that correspond to the effect specified for `effectIdentifier`. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | BatchableCommand |

### on

```
suspend fun on(): Unit
```

Turn on the device, and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to true.

### onBatchable

```
fun onBatchable(): BatchableCommand<Unit>
```

The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#on()` command.

Turn on the device, and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to true.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | BatchableCommand |

### onWithRecallGlobalScene

```
suspend fun onWithRecallGlobalScene(): Unit
```

Allow the recall of the settings (global scene) the device had when the device was turned off.

This command is ignored if the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#globalSceneControl()` attribute is true.

If the `globalSceneControl` attribute is false, the global scene is recalled, the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute is updated accordingly, and the `globalSceneControl` attribute is set to true.

When this command is called, if the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onTime()` attribute is 0, then the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#offWaitTime()` attribute is also set to 0.

### onWithRecallGlobalSceneBatchable

```
fun onWithRecallGlobalSceneBatchable(): BatchableCommand<Unit>
```

The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithRecallGlobalScene()` command.

Allow the recall of the settings (global scene) the device had when the device was turned off.

This command is ignored if the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#globalSceneControl()` attribute is true.

If the `globalSceneControl` attribute is false, the global scene is recalled, the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute is updated accordingly, and the `globalSceneControl` attribute is set to true.

When this command is called, if the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onTime()` attribute is 0, then the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#offWaitTime()` attribute is also set to 0.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | BatchableCommand |

### onWithTimedOff

```
suspend fun onWithTimedOff(
    onOffControl: OnOffTrait.OnOffControlBitmap,
    onTime: UShort,
    offWaitTime: UShort
): Unit
```

Allow the device to be turned on for a specific duration with a guarded off duration so that, should the device be subsequently turned off, further `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnWithTimedOffCommand.Request` commands received during this time are prevented from turning the devices back on.

| Parameters |
|---|---|
| `onOffControl: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnOffControlBitmap` | When set to `1`, the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithTimedOff(com.google.home.matter.standard.OnOffTrait.OnOffControlBitmap,kotlin.UShort,kotlin.UShort)` command will only be processed if the `onOff` attribute is `true`. When set to `0`, the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithTimedOff(com.google.home.matter.standard.OnOffTrait.OnOffControlBitmap,kotlin.UShort,kotlin.UShort)` command is always processed. |
| `onTime: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html` | The duration for which device is turned on. Sets the value of the `onTime` attribute. |
| `offWaitTime: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html` | The guarded off duration to set for the device. Sets the value of the `offWaitTime` attribute. |

### onWithTimedOffBatchable

```
fun onWithTimedOffBatchable(
    onOffControl: OnOffTrait.OnOffControlBitmap,
    onTime: UShort,
    offWaitTime: UShort
): BatchableCommand<Unit>
```

The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithTimedOff(com.google.home.matter.standard.OnOffTrait.OnOffControlBitmap,kotlin.UShort,kotlin.UShort)` command.

Allow the device to be turned on for a specific duration with a guarded off duration so that, should the device be subsequently turned off, further `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnWithTimedOffCommand.Request` commands received during this time are prevented from turning the devices back on.

| Parameters |
|---|---|
| `onOffControl: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnOffControlBitmap` | When set to `1`, the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithTimedOff(com.google.home.matter.standard.OnOffTrait.OnOffControlBitmap,kotlin.UShort,kotlin.UShort)` command will only be processed if the `onOff` attribute is `true`. When set to `0`, the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#onWithTimedOff(com.google.home.matter.standard.OnOffTrait.OnOffControlBitmap,kotlin.UShort,kotlin.UShort)` command is always processed. |
| `onTime: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html` | The duration for which device is turned on. Sets the value of the `onTime` attribute. |
| `offWaitTime: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html` | The guarded off duration to set for the device. Sets the value of the `offWaitTime` attribute. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | BatchableCommand |

### toggle

```
suspend fun toggle(): Unit
```

If the device is off, turn the device on and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to `true`.

If the device is on, turn the device off and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to `false`.

### toggleBatchable

```
fun toggleBatchable(): BatchableCommand<Unit>
```

The batchable version of `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#toggle()` command.

If the device is off, turn the device on and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to `true`.

If the device is on, turn the device off and set the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute to `false`.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/BatchableCommand<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html>` | BatchableCommand |