# Automation


```
interface Automation : HasId, HasCustomAppData, BaseAutomation, Updatable
```

<br />

Known direct subclasses [MutableAutomation](https://developers.home.google.com/reference/kotlin/com/google/home/automation/MutableAutomation)

|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/MutableAutomation` | Mutable attributes for an `Automation`. |

*** ** * ** ***

The main representation an automation, composed of various types of Automation nodes, including `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Starter` instances, `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Condition` instances, `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Action` instances, and more.

## 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/automation/Automation#execute()()` Execute the automation. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation#stop()()` Stop the automation. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation#compatibleWithSdk()` Whether the underlying automation data is compatible with the current SDK. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation#isRunning()` Whether the automation is currently running. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation#isValid()` Indicates whether or not the automation is valid. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation#manuallyExecutable()` Whether the automation can be manually executed via the execute() function. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/ValidationIssue>` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation#validationIssues()` List of automation graph compilation validation issues. |

### Inherited functions

From [com.google.home.HasCustomAppData](https://developers.home.google.com/reference/kotlin/com/google/home/HasCustomAppData) `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/HasCustomAppData#deleteValue(kotlin.String)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Deletes the value associated with the given `https://developers.home.google.com/reference/kotlin/com/google/home/HasCustomAppData#deleteValue(kotlin.String)`.
`suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` `https://developers.home.google.com/reference/kotlin/com/google/home/HasCustomAppData#getValue(kotlin.String)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Retrieves the value associated with the given `https://developers.home.google.com/reference/kotlin/com/google/home/HasCustomAppData#getValue(kotlin.String)`.
`suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/HasCustomAppData#updateValue(kotlin.String,kotlin.String)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Updates the value associated with the given `https://developers.home.google.com/reference/kotlin/com/google/home/HasCustomAppData#updateValue(kotlin.String,kotlin.String)`.
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/automation/Automation` `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/automation/Automation) -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html, init: https://developers.home.google.com/reference/kotlin/com/google/home/automation/MutableAutomation.() -> 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.automation.BaseAutomation](https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation) `https://developers.home.google.com/reference/kotlin/com/google/home/automation/AppManagedAutomationConfig?` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation#appManagedAutomationConfig()`

Configuration for app managed settings-based automations.
`https://developers.home.google.com/reference/kotlin/com/google/home/automation/SequentialFlow?` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation#automationGraph()`

List of `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node` instances.
`https://developers.home.google.com/reference/kotlin/com/google/home/platform/traits/AutomationSourceMetadata?` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation#automationSourceMetadata()`

Metadata about the source of the automation.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation#clientFeatureGroup()`

Unique identifier of the client feature group that the automation belongs to.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation#description()`

Description of this automation instance.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation#isActive()`

Whether the automation can execute.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation#name()`

User given name for the automation.
From [com.google.home.HasId](https://developers.home.google.com/reference/kotlin/com/google/home/HasId) `https://developers.home.google.com/reference/kotlin/com/google/home/Id` `https://developers.home.google.com/reference/kotlin/com/google/home/HasId#id()`

Opaque ID for the object.

## Public functions

### execute

```
suspend fun execute(): Unit
```

Execute the automation.

### stop

```
suspend fun stop(): Unit
```

Stop the automation.

## Public properties

### compatibleWithSdk

```
val compatibleWithSdk: Boolean
```

Whether the underlying automation data is compatible with the current SDK. When it is not compatible, user will be blocked from editing the automation graph. Metadata (such as name, description, etc) are still allowed to be changed. Activation/Deactivation are still allowed through the Update API. Delete/Get/List are still allowed.

Set to `true` if the AutomationGraph proto doesn't contain unknown fields.

### isRunning

```
val isRunning: Boolean
```

Whether the automation is currently running.

### isValid

```
val isValid: Boolean
```

Indicates whether or not the automation is valid.

### manuallyExecutable

```
val manuallyExecutable: Boolean
```

Whether the automation can be manually executed via the execute() function.

Set to `true` if both of the following conditions are `true`:

- The `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` is valid.

- `automationGraph` contains a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/ManualStarter` node.

  - In some cases, the platform determines the automation can be implicitly manually executed without a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/ManualStarter` node.

### validationIssues

```
val validationIssues: List<ValidationIssue>
```

List of automation graph compilation validation issues. Empty by default.