# HasAutomations

# HasAutomations


```
interface HasAutomations
```

<br />

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

|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/Structure` | The top-level organizing construct for the `https://developers.home.google.com/reference/kotlin/com/google/home/Home`. |

*** ** * ** ***

Interface that allows for `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` creation, retrieval, update, and deletion operations.

## Summary

| ### Public functions |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/HomeObjectsFlow<https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation>` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations#automations()()` List all automations belonging to the structure. |
| `suspend https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations#createAutomation(com.google.home.automation.BaseAutomation)(automation: https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation)` Create an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations#deleteAutomation(com.google.home.automation.Automation)(automation: https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation)` Delete an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations#deleteAutomation(com.google.home.Id)(automationId: https://developers.home.google.com/reference/kotlin/com/google/home/Id)` Delete an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` using an ID. |

## Public functions

### automations

```
fun automations(): HomeObjectsFlow<Automation>
```

List all automations belonging to the structure. Only automations created through the Home APIs are returned.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/HomeObjectsFlow<https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation>` | The automations belonging to the structure that were created through the Home APIs. |

### createAutomation

```
suspend fun createAutomation(automation: BaseAutomation): Automation
```

Create an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`. If successful, this returns the newly-created `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`. If a fatal error such as `PERMISSION_DENIED` is encountered, this throws HomeException.

| Parameters |
|---|---|
| `automation: https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation` | The `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` on which to base the new `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` | The created `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`. |

### deleteAutomation

```
suspend fun deleteAutomation(automation: Automation): Unit
```

Delete an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`.

| Parameters |
|---|---|
| `automation: https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` | The `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` to delete. |

### deleteAutomation

```
suspend fun deleteAutomation(automationId: Id): Unit
```

Delete an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` using an ID.

| Parameters |
|---|---|
| `automationId: https://developers.home.google.com/reference/kotlin/com/google/home/Id` | The ID of the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` to delete. |