device-transitions
device-transitions - the audit of what changed on a device and who asked for it.
device-transitions - the audit of what changed on a device and who asked for it.
A transition is a FACT about one status field: it went from from to to at at, and the actor is the user, token, addon, action or scheduler whose command the hub mirror matched to the change, or device when nothing asked. The hub kernel (device-manager) writes the rows by batch through record; device-history owns the ledger, its retention and its removal hook. Reads answer from disk: an answered empty page is "no transitions".
null is "unknown", never 0: a from the mirror had not seen, a matchedAfterMs of a command that produced no change, a count not taken.
At a glance
| Capability | device-transitions |
| Provided by | An addon wraps the device and provides it. It is bound to a device through the device bindings and can be bound automatically to compatible devices. |
| Active providers per device | one |
| Device types | camera, light, siren, switch, sensor, climate, button, event-emitter, update, generic, notifier, script, automation, lock, cover, valve, humidifier, water-heater, fan, media-player, alarm-panel, control, presence, weather, weather-station, vacuum, lawn-mower, image, pet-feeder, pet-fountain, dishwasher, washer, dryer, gateway, heat-pump, energy-system, workload |
| Source | packages/types/src/capabilities/device-transitions.cap.ts |
Methods
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
listTransitions | query | yes | default |
getTransition | query | yes | default |
listRecentTransitions | query | yes | admin |
record | mutation | yes | admin |
getStatus | query | yes | admin |
listTransitions
query
Transitions of a device, newest first. limit is bounded; page with cursor. At most ONE of capName, actorKind, outcome per call - each is served by its own index.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
capName | string | no | |
actorKind | "user" | "addon" | "action" | "scheduler" | "composition" | "node" | "device" | no | |
outcome | "confirmed" | "device" | "already" | "unconfirmed" | "failed" | no | |
atFrom | number | no | |
atTo | number | no | |
limit | number | no (default 50) | |
cursor | string | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
transitions | ({ id: string; deviceId: number; at: number; capName: string; field: string; from: string | number | boolean | null | Record<string, unknown>; to: string | number | boolean | null | Record<string, unknown>; outcome: "con… | yes | |
nextCursor | string | null | yes |
getTransition
query
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
id | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
deviceId | number | yes | |
at | number | yes | |
capName | string | yes | |
field | string | yes | |
from | string | number | boolean | null | Record<string, unknown> | yes | |
to | string | number | boolean | null | Record<string, unknown> | yes | |
outcome | "confirmed" | "device" | "already" | "unconfirmed" | "failed" | yes | |
actor | { kind: "user"; userId: string; username: string; credential: "session" | "token" | "integration"; credentialId?: string } | { kind: "addon"; addonId: string; nodeId?: string; onBehalf?: { source: "homeassistant" | "home… | yes | |
command | { commandId: string; method: string; args: Record<string, unknown>; requestedAt: number; matchedAfterMs: number | null; error?: string } | no |
listRecentTransitions
query
The fleet page, newest first. At most ONE of actorKind, outcome per call.
Input
| Field | Type | Required | Description |
|---|---|---|---|
actorKind | "user" | "addon" | "action" | "scheduler" | "composition" | "node" | "device" | no | |
outcome | "confirmed" | "device" | "already" | "unconfirmed" | "failed" | no | |
atFrom | number | no | |
atTo | number | no | |
limit | number | no (default 50) | |
cursor | string | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
transitions | ({ id: string; deviceId: number; at: number; capName: string; field: string; from: string | number | boolean | null | Record<string, unknown>; to: string | number | boolean | null | Record<string, unknown>; outcome: "con… | yes | |
nextCursor | string | null | yes |
record
mutation
Kernel write: device-manager delivers a batch. Refused for any other caller.
Input
| Field | Type | Required | Description |
|---|---|---|---|
transitions | ({ id: string; deviceId: number; at: number; capName: string; field: string; from: string | number | boolean | null | Record<string, unknown>; to: string | number | boolean | null | Record<string, unknown>; outcome: "con… | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
written | number | yes | |
refused | ({ id: string; reason: "not-kernel" | "invalid" })[] | yes |
getStatus
query
Input
No fields.
Output
| Field | Type | Required | Description |
|---|---|---|---|
rows | number | null | yes | Rows in the ledger; null until counted. |
lastWriteAt | number | null | yes | |
refused | Record<string, number> | yes | Refused rows since start, by reason. |