script-runner
Script-runner cap.
Script-runner cap. Models HA script.* entities on DeviceType.Script. A Script is a pre-recorded action sequence that can be invoked imperatively — optionally with a variables map when the script declares input fields.
Variable-support is signalled by DeviceFeature.ScriptVariables so the UI gates a "with parameters" form without a slice fetch.
At a glance
| Capability | script-runner |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| Active providers per device | one |
| Device types | script |
| Source | packages/types/src/capabilities/script-runner.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
run
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
variables | Record<string, unknown> | no | Optional variables map — passed through to the upstream script. Provider rejects when the script doesn't declare input fields (gated by DeviceFeature.ScriptVariables). |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
script.run | Run script |
stop
mutation
Cancel a running script. Provider rejects when the script isn't currently running.
Input
No fields besides deviceId.
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
script.stop | Stop script | isRunning = false |
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
Runtime-state slice — mirrored by the kernel. UI script tile reads isRunning to render a spinner during execution and surfaces lastError / lastRunSuccess in the recent-runs panel.
| Field | Type | Required | Description |
|---|---|---|---|
isRunning | boolean | yes | Whether the script is currently executing. |
lastRunAt | number | yes | Ms epoch of the last invocation start. 0 when never run. |
lastRunSuccess | boolean | null | yes | Outcome of the last completed run. Null when never run or still running. |
lastError | string | null | yes | Failure description from the last completed run. Null on success or when never run. |
lastChangedAt | number | yes | Ms epoch when the slice was last updated. |