public enum LockState
- Object
- Enum<LockState>
- LockState
ImplementsComparable<LockState>
The state of a door lock, for Trait.LOCK_STATE and
Trait.TARGET_LOCK_STATE.
Only SECURED and UNSECURED may be written; the rest describe
situations an accessory reports and a caller cannot ask for.
Enum constants
SECURED | Locked. |
UNSECURED | Unlocked. |
PARTIALLY_LOCKED | The bolt is partly thrown: not locked, and not simply open either. |
JAMMED | The mechanism is stuck. |
UNKNOWN | The accessory could not say. |
Methods
public static LockState[] values() | |
public static LockState valueOf(String name) | |
public static LockState of(TraitValue value) | Reads a lock state out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answers UNKNOWN. |
public boolean isWritable() | Whether this state may be written to Trait.TARGET_LOCK_STATE. |
Inherited methods
Enum constant details
SECURED
SECUREDLocked.
Maps to HomeKit’s secured and Matter’s Locked.
UNSECURED
UNSECUREDUnlocked.
Maps to HomeKit’s unsecured and to both of Matter’s Unlocked and
Unlatched – the latter is a 1.4 addition meaning the latch has been
pulled back as well as the bolt, which HomeKit has no way to say.
PARTIALLY_LOCKED
PARTIALLY_LOCKEDThe bolt is partly thrown: not locked, and not simply open either.
Matter’s NotFullyLocked. Its own constant rather than being folded
into a neighbour, because both alternatives lose real information –
calling it JAMMED asserts a fault that may not exist, and calling it
UNKNOWN throws away a state the accessory was specific about.
HomeKit never produces this.
JAMMED
JAMMEDThe mechanism is stuck.
Unreachable outside HomeKit. HomeKit publishes a jam as a value of
the lock characteristic, so it arrives here. Matter reports it as a
LockOperationError or DoorLockAlarm event, and this release does
not claim Matter events – so a jammed Matter lock reports
PARTIALLY_LOCKED or UNKNOWN instead. Do not build a safety
feature on this constant.
UNKNOWN
UNKNOWNLockState
resolves to when it is null.Method details
values
public static LockState[] values()valueOf
public static LockState valueOf(String name)of
public static LockState of(TraitValue value)UNKNOWN.Parameters
valueTraitValue- a value read from
Trait.LOCK_STATEorTrait.TARGET_LOCK_STATE, ornull
Returns
nullisWritable
public boolean isWritable()Trait.TARGET_LOCK_STATE.