# OnOff

# OnOff


```
@Generated(value = ["GoogleHomePlatformCodegen"])
interface OnOff : OnOffTrait.Attributes, MatterTrait, Updatable, OnOffCommands
```

<br />

*** ** * ** ***

API for the OnOff trait. This trait provides an interface for turning devices on and off.

## Summary

| ### Nested types |
|---|
| `enum https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff.Attribute : https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html, https://developers.home.google.com/reference/kotlin/com/google/home/Field` Descriptor enum for this trait's attributes. |
| `enum https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff.Command : https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html` Descriptor enum for this trait's commands. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff#supports(com.google.home.matter.standard.OnOff.Attribute)(attribute: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff.Attribute)` |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff#supports(com.google.home.matter.standard.OnOff.Command)(command: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff.Command)` |

| ### Public properties |
|---|---|
| `open https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<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#factory()` |

| ### Inherited functions |
|---|
| From [com.google.home.matter.standard.OnOffCommands](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands) |---|---| | `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. | |
| From [com.google.home.matter.standard.OnOffTrait.Attributes](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes) |---|---| | `open https://developers.home.google.com/reference/kotlin/com/google/home/StructDescriptor` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalGenericApi https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#getDescriptor()()` Returns the descriptor for the struct. | | `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalGenericApi https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#getFieldValueById(kotlin.UInt)(tagId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-int/index.html)` Returns the value of the field for the given tag ID. | |
| From [com.google.home.TraitStateInvalidation](https://developers.home.google.com/reference/kotlin/com/google/home/TraitStateInvalidation) |---|---| | `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/TraitStateInvalidation#forceRead()()` | |
| From [com.google.home.Updatable](https://developers.home.google.com/reference/kotlin/com/google/home/Updatable) |---|---| | `suspend https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff` | `https://developers.home.google.com/reference/kotlin/com/google/home/Updatable#update(kotlin.Function1,kotlin.Function1)(optimisticReturn: (https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOff) -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html, init: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.MutableAttributes.() -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` Creates a mutable copy of an object and calls the given function to mutate it, then saves it and returns a new immutable copy with the updated state. | |

| ### Inherited properties |
|---|
| From [com.google.home.matter.standard.OnOffTrait.Attributes](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes) |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-int/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#acceptedCommandList()` A list of client-generated commands which are supported by this cluster server instance. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-int/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#attributeList()` A list of the attribute IDs of the attributes supported by the cluster instance. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#clusterRevision()` The revision of the server cluster specification supported by the cluster instance. | | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Feature` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#featureMap()` Whether the server supports zero or more optional cluster features. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-int/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#generatedCommandList()` A list of server-generated commands (server to client) which are supported by this cluster server instance. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html?` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#globalSceneControl()` When set to true, prevents the global scene from being destroyed by subsequent `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#off()` or `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#on()` commands. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html?` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#offWaitTime()` The length of time (in 0.1 seconds) that the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute is false before allowing another `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnWithTimedOffCommand.Request` command to turn the device back on. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html?` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` Whether the device type implemented on the endpoint is turned off (false) or turned on (true). | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html?` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onTime()` The length of time (in 0.1 seconds) that the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#onOff()` attribute is true before changing to false when using the `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.OnWithTimedOffCommand.Request` command. | | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.StartUpOnOffEnum?` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.Attributes#startUpOnOff()` The desired startup behavior of a device when supplied with power. | |
| From [com.google.home.Trait](https://developers.home.google.com/reference/kotlin/com/google/home/Trait) |---|---| | `https://developers.home.google.com/reference/kotlin/com/google/home/Trait.TraitMetadata` | `https://developers.home.google.com/reference/kotlin/com/google/home/Trait#metadata()` | |

## Public functions

### supports

```
fun supports(attribute: OnOff.Attribute): Boolean
```

### supports

```
fun supports(command: OnOff.Command): Boolean
```

## Public properties

### factory

```
open val factory: TraitFactory<OnOff>
```