# StateReaderNodeDsl

# StateReaderNodeDsl


```
interface StateReaderNodeDsl : AutomationFlowContributor
```

<br />

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

|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/ParallelFlowBuilder` | Type-safe builder that builds a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/ParallelFlow` node. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/SequentialFlowBuilder` | Type-safe builder that builds a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/SequentialFlow` Node. |

*** ** * ** ***

Interface for constructing `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader` nodes and contributing them to an automation flow.

## Summary

| ### Public functions |
|---|---|
| `open https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<T>` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReaderNodeDsl#stateReader(com.google.home.automation.TypedExpression,com.google.home.TraitFactory)( entityExpression: https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedEntity<HomeObjectType>?>, trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T> )` Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `open https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedEntity<U>, T>>` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait, U : HomeObjectType> https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReaderNodeDsl#stateReader(com.google.home.automation.TypedExpression,com.google.home.TraitFactory)( entityExpression: https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedEntity<U>>?>, trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T> )` Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `open https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<T>` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReaderNodeDsl#stateReader(com.google.home.Structure,com.google.home.TraitFactory)(structure: https://developers.home.google.com/reference/kotlin/com/google/home/Structure, trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)` Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `open https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<T>` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReaderNodeDsl#stateReader(com.google.home.HomeDevice,com.google.home.DeviceTypeFactory,com.google.home.TraitFactory)( device: https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice, deviceType: https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>, trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T> )` Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `open https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<T>` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReaderNodeDsl#stateReader(com.google.home.automation.UnknownEntity,com.google.home.TypeFactory,com.google.home.TraitFactory)( unknownEntity: https://developers.home.google.com/reference/kotlin/com/google/home/automation/UnknownEntity, entityType: https://developers.home.google.com/reference/kotlin/com/google/home/TypeFactory<HomeObjectType>, trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T> )` Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader` using an UnknownEntity. |

| ### Inherited functions |
|---|
| From [com.google.home.automation.AutomationFlowContributor](https://developers.home.google.com/reference/kotlin/com/google/home/automation/AutomationFlowContributor) |---|---| | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/AutomationFlowBuilder` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/AutomationFlowContributor#flowBuilder()()` | |

## Public functions

### stateReader

```
open fun <T : Trait> stateReader(
    entityExpression: TypedExpression<TypedEntity<HomeObjectType>?>,
    trait: TraitFactory<T>
): TypedExpression<T>
```

Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`.

| Parameters |
|---|---|
| `entityExpression: https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedEntity<HomeObjectType>?>` | The entity `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Expression` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>` | The `https://developers.home.google.com/reference/kotlin/com/google/home/Trait` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<T>` | A `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader` instance. |

### stateReader

```
open fun <T : Trait, U : HomeObjectType> stateReader(
    entityExpression: TypedExpression<List<TypedEntity<U>>?>,
    trait: TraitFactory<T>
): TypedExpression<Map<TypedEntity<U>, T>>
```

Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`.

| Parameters |
|---|---|
| `entityExpression: https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedEntity<U>>?>` | The entity list `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Expression` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>` | The `https://developers.home.google.com/reference/kotlin/com/google/home/Trait` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedEntity<U>, T>>` | A `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader` instance. |

### stateReader

```
open fun <T : Trait> stateReader(structure: Structure, trait: TraitFactory<T>): TypedExpression<T>
```

Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`.

| Parameters |
|---|---|
| `structure: https://developers.home.google.com/reference/kotlin/com/google/home/Structure` | The `https://developers.home.google.com/reference/kotlin/com/google/home/Structure` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>` | The `https://developers.home.google.com/reference/kotlin/com/google/home/Trait` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<T>` | A `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader` instance. |

### stateReader

```
open fun <T : Trait> stateReader(
    device: HomeDevice,
    deviceType: DeviceTypeFactory<DeviceType>,
    trait: TraitFactory<T>
): TypedExpression<T>
```

Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`.

| Parameters |
|---|---|
| `device: https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice` | The Device associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `deviceType: https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>` | The `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>` | The `https://developers.home.google.com/reference/kotlin/com/google/home/Trait` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<T>` | A `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader` instance. |

### stateReader

```
open fun <T : Trait> stateReader(
    unknownEntity: UnknownEntity,
    entityType: TypeFactory<HomeObjectType>,
    trait: TraitFactory<T>
): TypedExpression<T>
```

Build a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader` using an UnknownEntity. Automations created using this method will not be valid. This method can be used to create draft automations.

| Parameters |
|---|---|
| `unknownEntity: https://developers.home.google.com/reference/kotlin/com/google/home/automation/UnknownEntity` | The UnknownEntity associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |
| `entityType: https://developers.home.google.com/reference/kotlin/com/google/home/TypeFactory<HomeObjectType>` | The type associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Starter`. |
| `trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>` | The `https://developers.home.google.com/reference/kotlin/com/google/home/Trait` associated with the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader`. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<T>` | A `https://developers.home.google.com/reference/kotlin/com/google/home/automation/StateReader` instance. |