# Action

# Action


```
class Action : Node
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||
| ↳ | [com.google.home.automation.Node](https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node) ||
|   | ↳ | [com.google.home.automation.Action](https://developers.home.google.com/reference/kotlin/com/google/home/automation/Action) |

*** ** * ** ***

Represents a command that the automation can issue, such as turning on a device, or a change to the value of a trait attribute, such as increasing a temperature threshold.

## Summary

| ### Public constructors |
|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Action#Action(com.google.home.automation.Expression,com.google.home.automation.ActionBehavior)(entityExpression: https://developers.home.google.com/reference/kotlin/com/google/home/automation/Expression, behavior: https://developers.home.google.com/reference/kotlin/com/google/home/automation/ActionBehavior)` Create an `Action` instance from an entity and a `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType`. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Action#Action(com.google.home.HasId,com.google.home.DeviceTypeFactory,com.google.home.automation.ActionBehavior)( entity: https://developers.home.google.com/reference/kotlin/com/google/home/HasId, deviceType: https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>?, behavior: https://developers.home.google.com/reference/kotlin/com/google/home/automation/ActionBehavior )` Create an `Action` instance from an entity and a `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType`. |

| ### Public properties |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/ActionBehavior` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Action#behavior()` The behavior of the `Action`. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>?` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Action#deviceType()` The `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType` associated with the `Action`. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/HasId?` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Action#entity()` The unique ID for the entity associated with the `Action`. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Expression` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Action#entityExpression()` An expression that selects an entity or a list of entity associated with the `Action`. |

| ### Inherited properties |
|---|
| From [com.google.home.automation.Node](https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node) |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node#nodeId()` String identifier of this node. | |

## Public constructors

### Action

```
Action(entityExpression: Expression, behavior: ActionBehavior)
```

Create an `Action` instance from an entity and a `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType`. An entity may be a `Device` or a `Structure`.

| Parameters |
|---|---|
| `entityExpression: https://developers.home.google.com/reference/kotlin/com/google/home/automation/Expression` | An expression that selects an entity or a list of entities associated with the `Action`. |
| `behavior: https://developers.home.google.com/reference/kotlin/com/google/home/automation/ActionBehavior` | The behavior of the `Action`. |

### Action

```
Action(
    entity: HasId,
    deviceType: DeviceTypeFactory<DeviceType>? = null,
    behavior: ActionBehavior
)
```

Create an `Action` instance from an entity and a `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType`. An entity may be a `Device` or a `Structure`.

| Parameters |
|---|---|
| `entity: https://developers.home.google.com/reference/kotlin/com/google/home/HasId` | The unique ID for the entity associated with the `Action`. |
| `deviceType: https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>? = null` | The `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType` associated with the `Action`. |
| `behavior: https://developers.home.google.com/reference/kotlin/com/google/home/automation/ActionBehavior` | The behavior of the `Action`. |

## Public properties

### behavior

```
val behavior: ActionBehavior
```

The behavior of the `Action`.

### deviceType

```
val deviceType: DeviceTypeFactory<DeviceType>?
```

The `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType` associated with the `Action`.

### entity

```
val entity: HasId?
```

The unique ID for the entity associated with the `Action`. If the target is not a static entity, this is set to `null`.

### entityExpression

```
val entityExpression: Expression
```

An expression that selects an entity or a list of entity associated with the `Action`.