Lock
此集成会跟踪你环境中的门锁及其状态,并允许你控制它们。
- 为每把门锁维护单独状态,并提供组合状态
all_locks。 - 注册
lock.lock、lock.unlock和lock.open(释放门闩)操作来控制门锁。
Building block integration
This lock is a building block integration that cannot be added to Home Assistant directly, but is used and provided by other integrations. A building block integration differs from a typical integration that connects to a device or service. Instead, other integrations use this lock building block to provide entities, actions, and other functionality that you can use in your automations or dashboards. If one of your integrations uses this building block, this page documents the functionality the lock building block offers.
门锁实体的状态
门锁实体可以具有以下状态:
- Jammed:门锁当前卡住。
- Open:表示门锁当前是否处于打开状态。
- Opening:表示门锁当前是否正在打开。
- Locked:门锁当前已锁定。
- Locking:门锁当前正在锁定过程中。
- Unlocked:门锁当前已解锁。
- Unlocking:门锁当前正在解锁过程中。
- Unavailable:实体当前不可用。
- Unknown:当前状态未知。
操作
门锁集成提供以下操作:
操作:Lock
lock.lock 操作用于锁门。
示例
操作:Unlock
lock.unlock 操作用于开锁。
示例
使用操作
前往 Settings > Developer tools > Actions,然后从可用操作列表中选择 lock.lock、lock.unlock 或 lock.open。在 data 字段中输入类似下面示例的内容,然后选择 Perform action。

