# HasGenericEvents


```
@HomeExperimentalGenericApi
interface HasGenericEvents : HasEvents
```

<br />

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

|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/GenericDeviceType` |   |
| `https://developers.home.google.com/reference/kotlin/com/google/home/GenericEventProvider` |   |

*** ** * ** ***

Interface implemented by GenericDeviceType objects that have observable events.

## Summary

| ### Public functions |
|---|---|
| `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/HasGenericEvents#genericEvents()()` Gets a flow of all Events available for the object. |
| `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/HasGenericEvents#genericEvents(kotlin.String)(eventId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Gets a flow of a specific Event. |
| `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/HasGenericEvents#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`. |

| ### Inherited functions |
|---|
| From [com.google.home.HasEvents](https://developers.home.google.com/reference/kotlin/com/google/home/HasEvents) |---|---| | `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/HasEvents#events()()` Gets a flow of all Events available for the object. | | `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/HasEvents#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. | | `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/HasEvents#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`. | |

## Public functions

### genericEvents

```
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

```
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

```
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. |