Lock Mechanism - WizBangCrash/esp-homekit-devices GitHub Wiki
A HomeKit Lock Mechanism.
Type | Device Type |
---|---|
4 | Lock Mechanism |
The following configuration is available for lock mechanisms:
Section | Key | Description |
---|---|---|
Actions | "0", "1" etc. | The actions performed by the accessory |
Inching Time | "i" | Time period before returning accessory to previous state |
State & Status Inputs | "f[n]" & "g[n]" | Inputs that manage accessory state |
ICMP Ping Inputs | "q[n]" & "p[n]" | Ping inputs that manage accessory state |
Accessory Notifications | "m" | Notifications to send to another accessory |
Initial State | "s" | State a lock accessory enters on boot |
Actions on Boot | "xa" | Enable / Disable execution of accessory actions on boot |
Example
{
"a":[{
"t":4,
"i":3,
"0":{"r":[{"g":4,"v":1,"i":0.5}]},
"1":{"r":[{"g":4}]},
"b":[{"g":5,"p":0,"i":1,"t":0}]
}]
}
This is an example of a lock mechanism with an external push button ("t":4
).
The Inching Time of the accessory has bee set to 3 seconds ("i":3
), causing the
accessory to automatically re-lock, 3 seconds after being unlocked.
The lock mechanism is controlled using GPIO 4.
The external push button is connected to GPIO 5. With no pull-up ("p":0), inverted input (
"i":1) and single press that is opposite to the default (
"t":0`).
Actions
A lock mechanism has two actions.
Action | Press | Description |
---|---|---|
"0" | UNLOCK | (default) |
"1" | LOCK |
The Digital Outputs
"r": [{}]
for each should be configured to attain the desired state.
Accessory Notifications
The list of notifications "m"
supported by a lock mechanism are as follows:
Value | Notification |
---|---|
0 | Lock UNLOCK (default) |
1 | Lock LOCK |
Accessory notifications can be included as part of an action definition.
When an action occurs any one of the above notifications can be sent to
another accessory using the "m"
option within the action object.
See the general Accessory Notifications section for details of how to configure these notifications.
State and Status Inputs
State inputs "f[n]"
& Status Inputs "g[n]"
are supported by this accessory.
The supported list is:
Key | Action |
---|---|
"f0" | Perform action "0" (Unlock) |
"f1" | Perform action "1" (Lock) |
"g0" | Set accessory state to Unlock |
"g1" | Set accessory state to Lock |
Refer to State Inputs for more detail and examples.
ICMP Ping Inputs
ICMP Ping inputs "p[n]"
and "q[n]"
are supported by this accessory.
The supported list is:
Key | Action |
---|---|
"p0" | Perform action "0" (Unlock) |
"p1" | Perform action "1" (Lock) |
"q0" | Set accessory state to Unlock |
"q1" | Set accessory state to Lock |
Refer to ICMP Ping Inputs for more detail.
Initial State
The Initial State key is supported by this accessory. Refer to Initial State for more details.
Key | State | Description |
---|---|---|
"s" | 0 | UNLOCKED |
1 | LOCKED (default) | |
4 | Defined by fixed state inputs | |
5 | Last state before restart | |
6 | Opposite to last state before restart |