# OnOffTrait.ToggleCommand

# OnOffTrait.ToggleCommand


```
object OnOffTrait.ToggleCommand : CommandDescriptor
```

<br />

*** ** * ** ***

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`.

| See also |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffCommands#toggle()` | Use this command from the `trait(OnOff)` method. |

## Summary

| ### Nested types |
|---|
| `class https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.ToggleCommand.Request : https://developers.home.google.com/reference/kotlin/com/google/home/ClusterStruct` The request payload for the Toggle command. |
| `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalGenericApi enum https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.ToggleCommand.Request.CommandFields : 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 command's request fields. |

| ### Public properties |
|---|---|
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.ToggleCommand#commandId()` Unique id corresponding to the command. |
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.ToggleCommand#commandName()` Human-friendly name of the command. |
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-nothing/index.html?` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OnOffTrait.ToggleCommand#responseId()` Optional (for Matter only) ScopedCommandId corresponding to the command response (if any). |

| ### Inherited functions |
|---|
| From [com.google.home.CommandDescriptor](https://developers.home.google.com/reference/kotlin/com/google/home/CommandDescriptor) |---|---| | `open https://developers.home.google.com/reference/kotlin/com/google/home/Field?` | `https://developers.home.google.com/reference/kotlin/com/google/home/CommandDescriptor#getCommandRequestFieldByName(kotlin.String)(name: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` | |

## Public properties

### commandId

```
open val commandId: String
```

Unique id corresponding to the command.

### commandName

```
open val commandName: String
```

Human-friendly name of the command.

### responseId

```
open val responseId: Nothing?
```

Optional (for Matter only) ScopedCommandId corresponding to the command response (if any).