Lock

Keeps track which locks are in your environment, their state and allows you to control them.

  • Maintains a state per lock and a combined state all_locks.
  • Registers actions lock.lock, lock.unlock, and lock.open (unlatch) to control locks.

Note

Building block integration

This lock is a building block integration that cannot be added to your Home Assistant directly but is used and provided by other integrations.

A building block integration differs from the typical integration that connects to a device or service. Instead, other integrations that do integrate a device or service into Home Assistant use this lock building block to provide entities, services, and other functionality that you can use in your automations or dashboards.

If one of your integrations features this building block, this page documents the functionality the lock building block offers.

The state of a lock entity

A lock entity can have the following states:

  • Jammed: The lock is currently jammed.
  • Open: Indication of whether the lock is currently open.
  • Opening: Indication of whether the lock is currently opening.
  • Locked: The lock is currently locked.
  • Locking: The lock is in the process of being locked.
  • Unlocked: The lock is currently unlocked.
  • Unlocking: The lock is in the process of being unlocked.
  • Unavailable: The entity is currently unavailable.
  • Unknown: The state is not yet known.

Actions

A lock integration provides the following actions:

Action: Lock

The lock.lock action locks your door.

Data attribute Optional Description
entity_id no Entity of the relevant lock.
code yes Code used to lock the lock.

Example

actions:
  - action: lock.lock
    target:
      entity_id: lock.my_place
    data:
      code: "1234"

Action: Unlock

The lock.unlock action unlocks your door.

Data attribute Optional Description
entity_id no Entity of the relevant lock.
code yes Code used to unlock the lock.

Example

actions:
  - action: lock.unlock
    target:
      entity_id: lock.my_place
    data:
      code: "1234"

Action: Open

The lock.open action opens (unlatches) a lock.

Data attribute Optional Description
entity_id no Entity of the relevant lock.
code yes Code used to open the lock.

Example

actions:
  - action: lock.open
    target:
      entity_id: lock.my_place
    data:
      code: "1234"

Use the actions

Go to Settings > Developer tools > Actions, and choose lock.lock, lock.unlock, or lock.open from the list of available actions. Fill in the required data and select Perform action.