Objects
EntityChangeEvent
What an entity subscription handler receives.
EntityChangeEvent
Definition
interface EntityChangeEvent {
entityId: string;
oldState: EntityStateSnapshot;
newState: EntityStateSnapshot;
}Members
| Name | Type | Optional | Description |
|---|---|---|---|
entityId | string | no | — |
oldState | EntityStateSnapshot | no | — |
newState | EntityStateSnapshot | no | — |
apps/edge-runtime/src/core/smartapp/builtin/ambient.d.ts:346
EntityStateSnapshot
Shape of the argument passed to an entity-subscription handler (the handler registered via subscribe(target, filter, handler)). The host delivers { entityId, oldState, newState } — the same event block the StateMachine emits. Authors can type their handler with this instead of any: function onMotion(evt: EntityChangeEvent) { ... }.
Definition
interface EntityStateSnapshot {
state: string | null;
attributes?: Record<string, unknown>;
/** Audit-grade attribution for what caused this state.
* `actorType: 'physical'` marks a manual actuation of the device itself
* (wall paddle / knob) — inferred when the device's report didn't
* correlate to a recent outgoing command. Otherwise it names the actor
* that invoked the change (`'user'`, `'smart-app'`, `'lan-device'`,
* `'alarm-panel-user'`). Absent or `'system'` for autonomous/internal
* transitions. Use it to gate automations on manual interaction, e.g.
* `if (evt.newState.context?.actorType === 'physical') { ... }`. */
context?: {
actorType?: 'user' | 'alarm-panel-user' | 'lan-device' | 'smart-app' | 'physical' | 'system';
contextId?: string;
user?: { userId: string; firstName?: string; lastName?: string };
smartApp?: { smartAppId: string; smartAppName?: string };
lanDevice?: { apiKeyId: string; label: string };
} | null;
}Members
| Name | Type | Optional | Description |
|---|---|---|---|
state | string | null | no | — |
attributes | Record<string, unknown> | yes | — |
context | { actorType?: 'user' | 'alarm-panel-user' | 'lan-device' | 'smart-app' | 'physical' | 'system'; contextId?: string; user?: { userId: string; firstName?: string; lastName?: string }; smartApp?: { smartAppId: string; smartAppName?: string }; lanDevice?: { apiKeyId: string; label: string }; } | null | yes | Audit-grade attribution for what caused this state. actorType: 'physical' marks a manual actuation of the device itself (wall paddle / knob) — inferred when the device's report didn't correlate to a recent outgoing command. Otherwise it names the actor that invoked the change ('user', 'smart-app', 'lan-device', 'alarm-panel-user'). Absent or 'system' for autonomous/internal transitions. Use it to gate automations on manual interaction, e.g. if (evt.newState.context?.actorType === 'physical') { ... }. |
apps/edge-runtime/src/core/smartapp/builtin/ambient.d.ts:327
Generated from docs-bundle v0.1.0, novon-platform 9ce3486c (2026-10-09).