ReferenceDevice capabilities
event-emitter
Generic stateless event emitter.
Generic stateless event emitter. Installed on a DeviceType.EventEmitter device. Carries the device's EXACT declared event vocabulary verbatim (NO normalization). Two shapes:
- structured source (HA
event.*entity) →vocabularyis the fixed declared set (e.g. press_short, press_long, …). - generic/legacy source (HA bus events, e.g. zha_event) →
vocabularyis [] (open) andlastEvent.datacarries the complex payload.vocabularynames each event for a person and types it for a rule;eventTypesis its list of native tokens, kept for older readers. A fire names the part of the device it came from insourceIdwhen the vocabulary declares sources (a remote's buttons).seqis monotonic so two identical events still produce distinct slice writes.
At a glance
| Capability | event-emitter |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| Active providers per device | one |
| Device types | event-emitter |
| Source | packages/types/src/capabilities/event-emitter.cap.ts |
Methods
This capability declares no methods.
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
| Field | Type | Required | Description |
|---|---|---|---|
eventTypes | string[] | yes | |
vocabulary | ({ id: string; source?: { id: string; label: string }; label: string; description?: string; kind?: "press" | "long-press" | "long-press-start" | "release" | "repeat" | "double-press" | "other"; payload?: ({ path: string;… | no (default []) | Required of a provider by the type. A status written before the field existed still parses, as an empty vocabulary: read it through readEventVocabulary, which then answers with the plain tokens. |
lastEvent | { deviceId: number; eventType: string; sourceId?: string; data: Record<string, unknown> | null; timestamp: number; seq: number } | null | yes | |
eventCountSinceStart | number | yes |
Events
onEvent
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
eventType | string | yes | |
sourceId | string | no | |
data | Record<string, unknown> | null | yes | |
timestamp | number | yes | |
seq | number | yes |