# GenericEventProvider


```
@HomeExperimentalGenericApi
class GenericEventProvider : HasGenericEvents
```

<br />

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider#GenericEventProvider(kotlin.coroutines.SuspendFunction0,kotlin.collections.Set)( deviceProvider: (suspend () -> https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice?)?, genericTraits: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericTrait> )` |

| ### Public functions |
|---|---|
| `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/Event>` | `https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider#events()()` Gets a flow of all Events available for the object. |
| `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<T>` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Event> https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider#events(com.google.home.EventFactory)(event: https://developers.home.google.com/reference/kotlin/com/google/home/EventFactory<T>)` Gets a flow of a specific Event. |
| `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/Event>` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider#events(com.google.home.TraitFactory)(trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)` Gets a flow of all Events by this `https://developers.home.google.com/reference/kotlin/com/google/home/Trait`. |
| `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericEvent>` | `https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider#genericEvents()()` Gets a flow of all Events available for the object. |
| `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericEvent>` | `https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider#genericEvents(kotlin.String)(eventId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Gets a flow of a specific Event. |
| `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericEvent>` | `https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider#genericTraitEvents(kotlin.String)(traitId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Gets a flow of all Events by this `https://developers.home.google.com/reference/kotlin/com/google/home/Trait`. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider#supportedEvents()` |

## Public constructors

### GenericEventProvider

```
GenericEventProvider(
    deviceProvider: (suspend () -> HomeDevice?)?,
    genericTraits: Set<GenericTrait>
)
```

## Public functions

### events

```
open fun events(): Flow<Event>
```

Gets a flow of all Events available for the object.

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/Event>` | The flow for all Events on this object. |

### events

```
open fun <T : Event> events(event: EventFactory<T>): Flow<T>
```

Gets a flow of a specific Event.

| Parameters |
|---|---|
| `event: https://developers.home.google.com/reference/kotlin/com/google/home/EventFactory<T>` | the Event to subscribe to. |

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<T>` | the flow for the Event. |

### events

```
open fun <T : Trait> events(trait: TraitFactory<T>): Flow<Event>
```

Gets a flow of all Events by this `https://developers.home.google.com/reference/kotlin/com/google/home/Trait`.

| Parameters |
|---|---|
| `trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>` | the Trait for which to subscribe to Events. |

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/Event>` | the flow for Trait Events. |

### genericEvents

```
open fun genericEvents(): Flow<GenericEvent>
```

Gets a flow of all Events available for the object.

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericEvent>` | The flow for all Events on this object. |

### genericEvents

```
open fun genericEvents(eventId: String): Flow<GenericEvent>
```

Gets a flow of a specific Event.

| Parameters |
|---|---|
| `eventId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | the EventId to subscribe to. |

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericEvent>` | the flow for the Event. |

### genericTraitEvents

```
open fun genericTraitEvents(traitId: String): Flow<GenericEvent>
```

Gets a flow of all Events by this `https://developers.home.google.com/reference/kotlin/com/google/home/Trait`.

| Parameters |
|---|---|
| `traitId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | the Trait for which to subscribe to Events. |

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericEvent>` | the flow for Trait Events. |

## Public properties

### supportedEvents

```
val supportedEvents: Set<String>
```