struct DoorLockTrait
This trait provides an interface to a generic way to secure a door.
-
List of the event types that are supported by
DoorLockTrait
.Declaration
Swift
static let supportedEventTypes: [any Event.Type]
-
List of the commands that are supported by
DoorLockTrait
.Declaration
Swift
static let supportedCommandTypes: [any Command.Type]
-
The trait identifier.
Declaration
Swift
static let identifier: String
-
Metadata about this
Trait
.Declaration
Swift
let metadata: TraitMetadata
-
List of attributes for the
DoorLockTrait
.Declaration
Swift
let attributes: Matter.DoorLockTrait.Attributes
-
Creates a new Trait instance using data read from the given
TraitDecoder
.Throws
HomeError.parseError
when parsing fails.Declaration
Swift
init(decoder: TraitDecoder, interactionProxy: (any InteractionProxy)?, metadata: TraitMetadata) throws
Parameters
decoder
The raw data representing this Trait.
interactionProxy
Proxy to the Interaction Client.
metadata
Metadata about this Trait.
-
Writes this object to the given
TraitEncoder
. ThrowsHomeError.encodingFailed
if the data could not be encoded.Declaration
Swift
func encode(with encoder: TraitEncoder) throws
-
This API provides the ability to invalidate state retrieved through subscriptions to the target device in the cases where state is not being reported correctly, either intentionally (e.g attributes in Matter traits with the “C” quality) or unintentionally due to poor implementations.
When successful, this API will result in a forced read of the convening scope as specified by the sub-class and return the result through existing Trait subscriptions if present and active.
This API is to be used sparingly as it can impact the performance and battery life of the target device. As such, this API may be throttled by the platform. Callers SHALL be prepared to deal with
HomeError
s thrown by this call.Declaration
Swift
func forceRead() async throws
-
Attributes for the
DoorLockTrait
.Declaration
Swift
struct Attributes
-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values
a
andb
,a == b
implies thata != b
isfalse
.Parameters
lhs
A value to compare.
rhs
Another value to compare.
-
Hashes the essential components of this value by feeding them into the given hasher.
Implement this method to conform to the
Hashable
protocol. The components used for hashing must be the same as the components compared in your type’s==
operator implementation. Callhasher.combine(_:)
with each of these components.Important
In your implementation of
hash(into:)
, don’t callfinalize()
on thehasher
instance provided, or replace it with a different instance. Doing so may become a compile-time error in the future.Declaration
Swift
func hash(into hasher: inout Hasher)
-
A set of credentials used when operating the door lock.
Declaration
Swift
struct CredentialStruct
-
Indicates that there is a critical state on the door lock.
Declaration
Swift
struct DoorLockAlarmEvent
-
Indicates that the state of the door has changed.
Declaration
Swift
struct DoorStateChangeEvent
-
Indicates that a lock operation has taken place.
Declaration
Swift
struct LockOperationEvent
-
Indicates that a lock operation failed.
Declaration
Swift
struct LockOperationErrorEvent
-
Indicates that a lock user, schedule, or credential has changed.
Declaration
Swift
struct LockUserChangeEvent
-
Whether the device supports the
lockDoor
command for this trait.Declaration
Swift
var supportsLockDoorCommand: Bool { get }
-
Lock the door.
Declaration
Swift
func lockDoor(optionalArgsProvider: ((Matter.DoorLockTrait.LockDoorCommand.OptionalArgs) -> Void)? = nil) async throws
-
The batchable version of lockDoor command above.
See also
lockDoorDeclaration
Swift
func lockDoorBatchable(optionalArgsProvider: ((Matter.DoorLockTrait.LockDoorCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void>
-
Whether the device supports the
unlockDoor
command for this trait.Declaration
Swift
var supportsUnlockDoorCommand: Bool { get }
-
Unlock the door.
Declaration
Swift
func unlockDoor(optionalArgsProvider: ((Matter.DoorLockTrait.UnlockDoorCommand.OptionalArgs) -> Void)? = nil) async throws
-
The batchable version of unlockDoor command above.
See also
unlockDoorDeclaration
Swift
func unlockDoorBatchable(optionalArgsProvider: ((Matter.DoorLockTrait.UnlockDoorCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void>
-
Whether the device supports the
unlockWithTimeout
command for this trait.Declaration
Swift
var supportsUnlockWithTimeoutCommand: Bool { get }
-
Unlock the door with a timeout parameter. After the timeout, the door automatically relocks.
Declaration
Swift
func unlockWithTimeout(timeout: UInt16, optionalArgsProvider: ((Matter.DoorLockTrait.UnlockWithTimeoutCommand.OptionalArgs) -> Void)? = nil) async throws
Parameters
timeout
The number of seconds to wait before relocking the door lock.
-
The batchable version of unlockWithTimeout command above.
See also
unlockWithTimeoutDeclaration
Swift
func unlockWithTimeoutBatchable(timeout: UInt16, optionalArgsProvider: ((Matter.DoorLockTrait.UnlockWithTimeoutCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void>
-
Whether the device supports the
setWeekDaySchedule
command for this trait.Declaration
Swift
var supportsSetWeekDayScheduleCommand: Bool { get }
-
Set a weekly repeating schedule for the specified user.
Declaration
Swift
func setWeekDaySchedule(weekDayIndex: UInt8, userIndex: UInt16, daysMask: Matter.DoorLockTrait.DaysMaskMap, startHour: UInt8, startMinute: UInt8, endHour: UInt8, endMinute: UInt8) async throws
Parameters
weekDayIndex
The unique identifier for the week day.
userIndex
The unique identifier for the user for whom the repeating schedule is being set.
daysMask
The days that constitute the repeating schedule. Valid values are defined by
DaysMaskMap
.startHour
The start hour of the repeating event.
startMinute
The start minute of the repeating event.
endHour
The end hour of the repeating event.
endMinute
The end minute of the repeating event.
-
setWeekDayScheduleBatchable(weekDayIndex:userIndex:daysMask:startHour:startMinute:endHour:endMinute:)
The batchable version of setWeekDaySchedule command above.
See also
setWeekDayScheduleDeclaration
Swift
func setWeekDayScheduleBatchable(weekDayIndex: UInt8, userIndex: UInt16, daysMask: Matter.DoorLockTrait.DaysMaskMap, startHour: UInt8, startMinute: UInt8, endHour: UInt8, endMinute: UInt8) throws -> BatchableCommand<Void>
-
Whether the device supports the
getWeekDaySchedule
command for this trait.Declaration
Swift
var supportsGetWeekDayScheduleCommand: Bool { get }
-
Retrieve the weekly schedule for the specified user. Week day schedules are used to restrict access to a specified time window on certain days of the week. The schedule is repeated each week.
Declaration
Swift
func getWeekDaySchedule(weekDayIndex: UInt8, userIndex: UInt16) async throws -> Matter.DoorLockTrait.GetWeekDayScheduleCommandResponse
Parameters
weekDayIndex
The unique identifier for the week day schedule to retrieve.
userIndex
The unique identifier for the user whose week day schedule is to be retrieved.
Return Value
Returns the weekly repeating schedule data for the specified schedule index.
-
The batchable version of getWeekDaySchedule command above.
See also
getWeekDayScheduleDeclaration
Swift
func getWeekDayScheduleBatchable(weekDayIndex: UInt8, userIndex: UInt16) throws -> BatchableCommand<Matter.DoorLockTrait.GetWeekDayScheduleCommandResponse>
-
Whether the device supports the
clearWeekDaySchedule
command for this trait.Declaration
Swift
var supportsClearWeekDayScheduleCommand: Bool { get }
-
Clear the specified week day schedule or all week day schedules for the specific user. Week day schedules are used to restrict access to a specified time window on certain days of the week. The schedule is repeated each week.
Declaration
Swift
func clearWeekDaySchedule(weekDayIndex: UInt8, userIndex: UInt16) async throws
Parameters
weekDayIndex
The unique identifier for the week day schedule to clear.
0xFE
clears all week day schedules for the specified user.userIndex
The unique identifier for the user whose schedule is to be cleared.
-
The batchable version of clearWeekDaySchedule command above.
See also
clearWeekDayScheduleDeclaration
Swift
func clearWeekDayScheduleBatchable(weekDayIndex: UInt8, userIndex: UInt16) throws -> BatchableCommand<Void>
-
Whether the device supports the
setYearDaySchedule
command for this trait.Declaration
Swift
var supportsSetYearDayScheduleCommand: Bool { get }
-
Set a time-specific schedule ID for a specified user.
Declaration
Swift
func setYearDaySchedule(yearDayIndex: UInt8, userIndex: UInt16, localStartTime: UInt32, localEndTime: UInt32) async throws
Parameters
yearDayIndex
The unique identifier for the year day schedule.
userIndex
The unique identifier for the user for whom the repeating schedule is being set.
localStartTime
The starting time for the year day schedule in Epoch Time in seconds with local time offset based on the local timezone and DST offset on the day represented by the value.
localEndTime
The ending time for the year day schedule in Epoch Time in seconds with local time offset based on the local timezone and DST offset on the day represented by the value.
-
The batchable version of setYearDaySchedule command above.
See also
setYearDayScheduleDeclaration
Swift
func setYearDayScheduleBatchable(yearDayIndex: UInt8, userIndex: UInt16, localStartTime: UInt32, localEndTime: UInt32) throws -> BatchableCommand<Void>
-
Whether the device supports the
getYearDaySchedule
command for this trait.Declaration
Swift
var supportsGetYearDayScheduleCommand: Bool { get }
-
Retrieve the specified year day schedule for the specified user. Year day schedules are used to restrict access to a specified date and time window.
Declaration
Swift
func getYearDaySchedule(yearDayIndex: UInt8, userIndex: UInt16) async throws -> Matter.DoorLockTrait.GetYearDayScheduleCommandResponse
Parameters
yearDayIndex
The unique identifier for the year day schedule to be retrieved.
userIndex
The unique identifier for the user whose year day schedule is to be retrieved.
Return Value
Returns the year day schedule data for the specified schedule and user indexes.
-
The batchable version of getYearDaySchedule command above.
See also
getYearDayScheduleDeclaration
Swift
func getYearDayScheduleBatchable(yearDayIndex: UInt8, userIndex: UInt16) throws -> BatchableCommand<Matter.DoorLockTrait.GetYearDayScheduleCommandResponse>
-
Whether the device supports the
clearYearDaySchedule
command for this trait.Declaration
Swift
var supportsClearYearDayScheduleCommand: Bool { get }
-
Clear the specified year day schedule, or all year day schedules for the specific user. Year day schedules are used to restrict access to a specified date and time window.
Declaration
Swift
func clearYearDaySchedule(yearDayIndex: UInt8, userIndex: UInt16) async throws
Parameters
yearDayIndex
The unique identifier for the year day schedule to clear.
0xFE
clears all year day schedules for the specified user.userIndex
The unique identifier for the user whose year day schedule is to be cleared.
-
The batchable version of clearYearDaySchedule command above.
See also
clearYearDayScheduleDeclaration
Swift
func clearYearDayScheduleBatchable(yearDayIndex: UInt8, userIndex: UInt16) throws -> BatchableCommand<Void>
-
Whether the device supports the
setHolidaySchedule
command for this trait.Declaration
Swift
var supportsSetHolidayScheduleCommand: Bool { get }
-
Set the holiday schedule by specifying the local start and end time with respect to a specific lock operating mode.
Declaration
Swift
func setHolidaySchedule(holidayIndex: UInt8, localStartTime: UInt32, localEndTime: UInt32, operatingMode: Matter.DoorLockTrait.OperatingModeEnum) async throws
Parameters
holidayIndex
The unique identifier for the holiday whose schedule is to be set.
localStartTime
The starting time for the holiday schedule in Epoch Time in seconds with local time offset based on the local timezone and DST offset on the day represented by the value.
localEndTime
The ending time for the holiday schedule in Epoch Time in seconds with local time offset based on the local timezone and DST offset on the day represented by the value.
operatingMode
The operating mode to use for the specified holiday schedule start and end time. Valid values are defined by
OperatingModeEnum
. -
The batchable version of setHolidaySchedule command above.
See also
setHolidayScheduleDeclaration
Swift
func setHolidayScheduleBatchable(holidayIndex: UInt8, localStartTime: UInt32, localEndTime: UInt32, operatingMode: Matter.DoorLockTrait.OperatingModeEnum) throws -> BatchableCommand<Void>
-
Whether the device supports the
getHolidaySchedule
command for this trait.Declaration
Swift
var supportsGetHolidayScheduleCommand: Bool { get }
-
Get the holiday schedule for the specified holiday index.
Declaration
Swift
func getHolidaySchedule(holidayIndex: UInt8) async throws -> Matter.DoorLockTrait.GetHolidayScheduleCommandResponse
Parameters
holidayIndex
The unique identifier for the holiday schedule to retrieve.
Return Value
Returns the holiday schedule entry for the specified holiday ID.
-
The batchable version of getHolidaySchedule command above.
See also
getHolidayScheduleDeclaration
Swift
func getHolidayScheduleBatchable(holidayIndex: UInt8) throws -> BatchableCommand<Matter.DoorLockTrait.GetHolidayScheduleCommandResponse>
-
Whether the device supports the
clearHolidaySchedule
command for this trait.Declaration
Swift
var supportsClearHolidayScheduleCommand: Bool { get }
-
Clear the specified holiday schedule, or all holiday schedules.
Declaration
Swift
func clearHolidaySchedule(holidayIndex: UInt8) async throws
Parameters
holidayIndex
The unique identifier for the holiday schedule to clear.
0xFE
clears all holiday schedules. -
The batchable version of clearHolidaySchedule command above.
See also
clearHolidayScheduleDeclaration
Swift
func clearHolidayScheduleBatchable(holidayIndex: UInt8) throws -> BatchableCommand<Void>
-
Whether the device supports the
setUser
command for this trait.Declaration
Swift
var supportsSetUserCommand: Bool { get }
-
Set the user on the lock.
Declaration
Swift
func setUser(operationType: Matter.DoorLockTrait.DataOperationTypeEnum, userIndex: UInt16, userName: String?, userUniqueID: UInt32?, userStatus: Matter.DoorLockTrait.UserStatusEnum?, userType: Matter.DoorLockTrait.UserTypeEnum?, credentialRule: Matter.DoorLockTrait.CredentialRuleEnum?) async throws
Parameters
operationType
The operation to perform. Valid values are defined by
DataOperationTypeEnum
.userIndex
The unique identifier for the user to set on the lock.
userName
The user name of the user to set on the lock.
userStatus
The status of the user to set on the lock. Valid values are defined by
UserStatusEnum
.userType
The type of the user. Valid values are defined by
UserTypeEnum
.credentialRule
The credential rule. Valid values are defined by
CredentialRuleEnum
. -
The batchable version of setUser command above.
See also
setUserDeclaration
Swift
func setUserBatchable(operationType: Matter.DoorLockTrait.DataOperationTypeEnum, userIndex: UInt16, userName: String?, userUniqueID: UInt32?, userStatus: Matter.DoorLockTrait.UserStatusEnum?, userType: Matter.DoorLockTrait.UserTypeEnum?, credentialRule: Matter.DoorLockTrait.CredentialRuleEnum?) throws -> BatchableCommand<Void>
-
Whether the device supports the
getUser
command for this trait.Declaration
Swift
var supportsGetUserCommand: Bool { get }
-
Retrieve the user type for a specific user.
Declaration
Swift
func getUser(userIndex: UInt16) async throws -> Matter.DoorLockTrait.GetUserCommandResponse
Parameters
userIndex
The unique identifier for the user whose type is to be retrieved.
Return Value
Returns the user for the specified
userIndex
. -
The batchable version of getUser command above.
See also
getUserDeclaration
Swift
func getUserBatchable(userIndex: UInt16) throws -> BatchableCommand<Matter.DoorLockTrait.GetUserCommandResponse>
-
Whether the device supports the
clearUser
command for this trait.Declaration
Swift
var supportsClearUserCommand: Bool { get }
-
Clear the specified user.
Declaration
Swift
func clearUser(userIndex: UInt16) async throws
Parameters
userIndex
The unique identifier for the user to clear.
0xFFFE
clears all users. -
The batchable version of clearUser command above.
See also
clearUserDeclaration
Swift
func clearUserBatchable(userIndex: UInt16) throws -> BatchableCommand<Void>
-
Whether the device supports the
setCredential
command for this trait.Declaration
Swift
var supportsSetCredentialCommand: Bool { get }
-
Set a credential into the lock for a new or existing user, or for a programming user.
Declaration
Swift
func setCredential(operationType: Matter.DoorLockTrait.DataOperationTypeEnum, credential: Matter.DoorLockTrait.CredentialStruct, credentialData: Data, userIndex: UInt16?, userStatus: Matter.DoorLockTrait.UserStatusEnum?, userType: Matter.DoorLockTrait.UserTypeEnum?) async throws -> Matter.DoorLockTrait.SetCredentialCommandResponse
Parameters
operationType
The operation to be performed.
credential
The credential to be set.
credentialData
The credential data to set for the credential being added or modified.
userIndex
The unique identifier for the user record that corresponds to the credential being added or modified.
userStatus
The user status to use in the new user record if a new user is being created. Valid values are defined by
UserStatusEnum
.userType
The user type to use in the new user record if a new user is being created. Valid values are defined by
UserTypeEnum
.Return Value
The status for setting the specified credential.
-
The batchable version of setCredential command above.
See also
setCredentialDeclaration
Swift
func setCredentialBatchable(operationType: Matter.DoorLockTrait.DataOperationTypeEnum, credential: Matter.DoorLockTrait.CredentialStruct, credentialData: Data, userIndex: UInt16?, userStatus: Matter.DoorLockTrait.UserStatusEnum?, userType: Matter.DoorLockTrait.UserTypeEnum?) throws -> BatchableCommand<Matter.DoorLockTrait.SetCredentialCommandResponse>
-
Whether the device supports the
getCredentialStatus
command for this trait.Declaration
Swift
var supportsGetCredentialStatusCommand: Bool { get }
-
Retrieve the status of the specified credential.
Declaration
Swift
func getCredentialStatus(credential: Matter.DoorLockTrait.CredentialStruct) async throws -> Matter.DoorLockTrait.GetCredentialStatusCommandResponse
Parameters
credential
The credential whose status is to be retrieved.
Return Value
Returns the status for the specified credential.
-
The batchable version of getCredentialStatus command above.
See also
getCredentialStatusDeclaration
Swift
func getCredentialStatusBatchable(credential: Matter.DoorLockTrait.CredentialStruct) throws -> BatchableCommand<Matter.DoorLockTrait.GetCredentialStatusCommandResponse>
-
Whether the device supports the
clearCredential
command for this trait.Declaration
Swift
var supportsClearCredentialCommand: Bool { get }
-
Clear a single credential, one type of credential, or all credentials except
ProgrammingPIN
credentials.Declaration
Swift
func clearCredential(credential: Matter.DoorLockTrait.CredentialStruct?) async throws
Parameters
credential
The credential to be cleared.
-
The batchable version of clearCredential command above.
See also
clearCredentialDeclaration
Swift
func clearCredentialBatchable(credential: Matter.DoorLockTrait.CredentialStruct?) throws -> BatchableCommand<Void>
-
Whether the device supports the
unboltDoor
command for this trait.Declaration
Swift
var supportsUnboltDoorCommand: Bool { get }
-
Disengage the deadbolt.
Declaration
Swift
func unboltDoor(optionalArgsProvider: ((Matter.DoorLockTrait.UnboltDoorCommand.OptionalArgs) -> Void)? = nil) async throws
-
The batchable version of unboltDoor command above.
See also
unboltDoorDeclaration
Swift
func unboltDoorBatchable(optionalArgsProvider: ((Matter.DoorLockTrait.UnboltDoorCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void>
-
Whether the device supports the
setAliroReaderConfig
command for this trait.Declaration
Swift
var supportsSetAliroReaderConfigCommand: Bool { get }
-
The batchable version of setAliroReaderConfig command above.
See also
setAliroReaderConfigDeclaration
Swift
func setAliroReaderConfigBatchable(signingKey: Data, verificationKey: Data, groupIdentifier: Data, optionalArgsProvider: ((Matter.DoorLockTrait.SetAliroReaderConfigCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void>
-
Whether the device supports the
clearAliroReaderConfig
command for this trait.Declaration
Swift
var supportsClearAliroReaderConfigCommand: Bool { get }
-
The batchable version of clearAliroReaderConfig command above.
See also
clearAliroReaderConfigDeclaration
Swift
func clearAliroReaderConfigBatchable() throws -> BatchableCommand<Void>
-
Alarm codes.
Declaration
Swift
enum AlarmCodeEnum
-
Indicates the credential rule that can be applied to a particular user.
Declaration
Swift
enum CredentialRuleEnum
-
Indicates the credential type.
Declaration
Swift
enum CredentialTypeEnum
-
Indicates the data operation performed.
Declaration
Swift
enum DataOperationTypeEnum
-
Door lock states.
Declaration
Swift
enum DlLockState
-
Lock types.
Declaration
Swift
enum DlLockType
-
Door lock statuses.
Declaration
Swift
enum DlStatus
-
Door lock operation event codes.
Declaration
Swift
enum DoorLockOperationEventCode
-
Door lock programming event codes.
Declaration
Swift
enum DoorLockProgrammingEventCode
-
Door lock credential status.
Declaration
Swift
enum DoorLockSetPinOrIdStatus
-
The status for a specific user.
Declaration
Swift
enum DoorLockUserStatus
-
The type for a specific user.
Declaration
Swift
enum DoorLockUserType
-
Door states.
Declaration
Swift
enum DoorStateEnum
-
Data types associated with door locks.
Declaration
Swift
enum LockDataTypeEnum
-
The type of Lock operation performed.
Declaration
Swift
enum LockOperationTypeEnum
-
Operating modes.
Declaration
Swift
enum OperatingModeEnum
-
Indicates the cause of the Lock or Unlock operation failure.
Declaration
Swift
enum OperationErrorEnum
-
Indicates the source of the Lock or Unlock operation.
Declaration
Swift
enum OperationSourceEnum
-
The status for a specific user.
Declaration
Swift
enum UserStatusEnum
-
The type of a specific user.
Declaration
Swift
enum UserTypeEnum
-
The days of the week.
Declaration
Swift
struct DaysMaskMap
-
Credential rules.
Declaration
Swift
struct DlCredentialRuleMask
-
Credential rules.
Declaration
Swift
struct DlCredentialRulesSupport
-
The default configurations as they are physically set on the device.
Declaration
Swift
struct DlDefaultConfigurationRegister
-
Event mask used to enable and disable the transmission of keypad operation events.
Declaration
Swift
struct DlKeypadOperationEventMask
-
Event mask used to enable and disable keypad programming events. Only applied to the Programming Event Notification Command.
Declaration
Swift
struct DlKeypadProgrammingEventMask
-
The local programming features that are disabled when the
enableLocalProgramming
attribute is set tofalse
.Declaration
Swift
struct DlLocalProgrammingFeatures
-
Manual operation events.
Declaration
Swift
struct DlManualOperationEventMask
-
Event mask used to enable and disable the transmission of RFID events.
Declaration
Swift
struct DlRfidOperationEventMask
-
Event mask used to enable and disable RFID programming events.
Declaration
Swift
struct DlRfidProgrammingEventMask
-
Event mask used to enable and disable the transmission of remote operation events.
Declaration
Swift
struct DlRemoteOperationEventMask
-
Event mask used to enable and disable remote programming events.
Declaration
Swift
struct DlRemoteProgrammingEventMask
-
This bitmap contains all operating bits of the Operating Mode Attribute supported by the lock.
Declaration
Swift
struct DlSupportedOperatingModes
-
Days of the week.
Declaration
Swift
struct DoorLockDayOfWeek
-
DoorLock cluster FeatureMap. Some behaviors of these features are described in the cluster attributes and commands. For complete details of these features, see the Matter Specification.
Declaration
Swift
struct Feature