lock-control
Smart-lock cap.
Smart-lock cap. Models HA lock.* entities — anything with a locked / unlocked binary state plus the four transient lifecycle states (locking / unlocking) and the jammed failure state that low-end deadbolts surface when the motor can't reach the target position.
Some HA locks require a PIN code on every lock/unlock operation (workplace keypad locks, hospitality). The optional code field on the methods passes it through to the upstream service — the code is NEVER persisted in the runtime slice or any event payload. Whether a lock REQUIRES a code is the slice's codeRequired (#459): true / false when the provider knows, null when it does not.
Locks that support a latch-release ("open door") action advertise DeviceFeature.LockOpen. The open method triggers the latch without a full lock/unlock cycle. Only available when the lock reports LockEntityFeature.OPEN (bit value 1) in HA supported_features.
door-open: the linked door contact reads open, so the bolt cannot be thrown. It is the lock's REAL reported state, written into the mirrored slice by the door-contact Customize extension — never a provider's own value, and never a projection a reader has to compute. Precedence: a native jammed wins; otherwise an open contact reports door-open whatever the native state says (locked included); a closed or unknown contact leaves the native state. A lock() is refused while the state is door-open; unlock() never is.
At a glance
| Capability | lock-control |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| Active providers per device | one |
| Device types | lock |
| Source | packages/types/src/capabilities/lock-control.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
lock | mutation | yes | protected |
unlock | mutation | yes | protected |
open | mutation | no | protected |
lock
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
code | string | no | Optional PIN code required by some keypad locks. NOT persisted — passed directly to the upstream service. |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
lock.lock | Lock | state = "locked" |
unlock
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
code | string | no | |
confirm | boolean | no | Honoured by a helper lock GROUP only: unlocking several doors with one call is refused unless the caller says it was confirmed. A single lock ignores it. The refusal lives in the callee, so no automation or API caller reaches the doors by skipping a dialog. |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
lock.unlock | Unlock | state = "unlocked" |
open
mutation · optional for a provider
Input
No fields besides deviceId.
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
lock.open | Open latch |
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 lock buttons read state and disable themselves during locking/unlocking transitions.
| Field | Type | Required | Description |
|---|---|---|---|
state | "locked" | "unlocked" | "locking" | "unlocking" | "jammed" | "door-open" | yes | Lifecycle state of the lock. jammed means the motor reported failure to reach the target — operator intervention required. |
codeRequired | boolean | null | no | Whether lock / unlock need a PIN code (#459, replaces the lock-pin-required device feature). null = the provider cannot tell — never false. .optional() so a restored slice written before the field still parses; readers treat absent exactly like null. |
lastChangedAt | number | yes | Ms epoch when the slice was last updated. |