Smart Lock Basic API

Last Updated on : 2024-06-13 02:45:52download

Smart lock basic API encapsulates common methods regarding temporary passwords, member management, logging capabilities, and more features. These methods apply to camera locks (categoryCode: wf_jtmspro) and smart video locks (categoryCode: videolock_1w_1).

Class name Description
ThingSmartLockApi Smart lock class that encapsulates basic API methods.

Temporary passwords

Temporary passwords are classified into online passwords and offline passwords.

  • Online temporary password: This type of password is generated when the respective lock runs online and then synced to the lock.

  • Offline temporary password: This type of password is generated even when the respective lock stays offline. Offline passwords are deleted differently from online passwords. The user needs to enter a clearing code on the lock to empty offline passwords.

The API methods to get online and offline passwords can vary, depending on different lock categories. These capabilities are implemented respectively for camera locks (categoryCode: wf_jtmspro) and smart video locks (categoryCode: videolock_1w_1).

Temporary passwords for camera locks

Create an online temporary password

API description

Creates an online temporary password.

- (void)addPhotoLockTemporaryPasswordWithDevId:(NSString *)devId
                                          name:(NSString *)name
                                         phone:(NSString *)phone
                                 effectiveTime:(NSInteger)effectiveTime
                                   invalidTime:(NSInteger)invalidTime
                                      password:(NSString *)password
                                      schedule:(NSString *)schedule
                                   countryCode:(NSString *)countryCode
                                     availTime:(NSInteger)availTime
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
name The name of the password.
phone The mobile phone number.
effectiveTime The start date and time.
invalidTime The end date and time.
password The password.
schedule The schedule.
countryCode The country code of the mobile phone number for the lock user.
availTime The number of times the password can be used.
success The success callback.
failure The failure callback.

Example

- (void)addPhotoLockTemporaryPasswordAPITest{
    [self.lockAPI addPhotoLockTemporaryPasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                                    name:@"pwd1111"
                                                   phone:@""
                                           effectiveTime:1659333273374
                                             invalidTime:1659938073374
                                                password:@"1234567"
                                                schedule:@"[{\"allDay\":true,\"effectiveTime\":360,\"invalidTime\":1080,\"workingDay\":127}]"
                                             countryCode:@"86"
                                               availTime:0
                                                 success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

Update the name of an online password

API description

- (void)updatePhotoLockTemporaryPasswordNameWithDevId:(NSString *)devId
                                                pwdId:(NSInteger )pwdId
                                                 name:(NSString *)name
                                              success:(ThingSuccessID)success
                                              failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
pwdId The ID of the password.
name The new name of the password.
success The success callback.
failure The failure callback.

Example

- (void)updatePhotoLockTemporaryPasswordNameAPITest{
    [self.lockAPI updatePhotoLockTemporaryPasswordNameWithDevId:@"6ce91a406cebe66b1f1gep"
                                                          pwdId:4575053
                                                           name:@"kandi-test-1"
                                                        success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Delete an online temporary password

API description

- (void)deletePhotoLockTemporaryPasswordWithDevId:(NSString *)devId
                                            pwdId:(NSInteger )pwdId
                                          success:(ThingSuccessID)success
                                          failure:(nullable ThingFailureError)failure;);

Parameter description

Parameters Description
devId The device ID.
pwdId The ID of the password.
success The success callback.
failure The failure callback.

Example

- (void)deletePhotoLockTemporaryPasswordAPITest{
    [self.lockAPI deletePhotoLockTemporaryPasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                                      pwdId:4575053
                                                    success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get the list of online passwords

API description

- (void)getPhotoLockTemporaryPasswordWithDevId:(NSString *)devId
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
success The success callback.
failure The failure callback.

Example

- (void)getPhotoLockTemporaryPasswordAPITest{
    [self.lockAPI getPhotoLockTemporaryPasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                                 success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

Get offline password of camera lock

An offline password is generated only in the cloud and returned to the app.

API description

- (void)addPhotoLockOfflinePasswordWithDevId:(NSString *)devId
                                     pwdType:(NSString *)pwdType
                                    gmtStart:(NSInteger)gmtStart
                                  gmtExpired:(NSInteger)gmtExpired
                                     pwdName:(NSString *)pwdName
                                 countryCode:(NSString *)countryCode
                                      mobile:(NSString *)mobile
                                     success:(ThingSuccessID)success
                                     failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
pwdType The type of the password.
  • 0: Unlimited times
  • 1: One-time
  • 9: Clearing code
gmtStart The start date and time.
gmtExpired The end date and time.
pwdName The name of the password.
countryCode The country code of the mobile phone number for the lock user.
mobile The mobile phone number.
success The success callback.
failure The failure callback.

Example

- (void)addPhotoLockOfflinePasswordAPITest{
    [self.lockAPI addPhotoLockOfflinePasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                               pwdType:@"1"
                                              gmtStart:0
                                            gmtExpired:[[NSDate date] timeIntervalSince1970]
                                               pwdName:@"kandi test"
                                           countryCode:@""
                                                mobile:@""
                                               success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Name an offline password

API description

- (void)setPhotoLockOfflinePasswordNameWithDevId:(NSString *)devId
                                           pwdId:(NSInteger )pwdId
                                         pwdName:(NSString *)pwdName
                                          mobile:(NSString *)mobile
                                         success:(ThingSuccessID)success
                                         failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
pwdId The ID of the password.
pwdName The name of the password.
mobile The mobile phone number.
success The success callback.
failure The failure callback.

Example

- (void)setPhotoLockOfflinePasswordNameAPITest{
    [self.lockAPI setPhotoLockOfflinePasswordNameWithDevId:@"6ce91a406cebe66b1f1gep"
                                                     pwdId:3586192
                                                   pwdName:@"CESHIxxx"
                                                    mobile:@""
                                                   success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get clearing code of offline passwords

API description

- (void)getPhotoLockOfflineEmptyCodeWithDevId:(NSString *)devId
                                        pwdId:(NSInteger )pwdId
                                      success:(ThingSuccessID)success
                                      failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
pwdId The ID of the password.
success The success callback.
failure The failure callback.

Example

- (void)getPhotoLockOfflineEmptyCodeAPITest{
    [self.lockAPI getPhotoLockOfflineEmptyCodeWithDevId:@"6ce91a406cebe66b1f1gep"
                                                  pwdId:3586192
                                                success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get the list of offline temporary passwords

API description

- (void)getOfflinePasswordListWithDevId:(NSString *)devId
                                pwdType:(NSString *)pwdType
                                 status:(NSInteger)status
                                 offset:(NSInteger)offset
                                  limit:(NSInteger)limit
                                success:(ThingSuccessID)success
                                failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
pwdType The type of the password.
  • 0: Unlimited times
  • 1: One-time
  • 9: Clearing code
status Password status.
  • 1: To be used
  • 2: Already used once
  • 3: Expired
offset The page number.
limit The maximum number of entries returned per page. Default value: 50.
success The success callback.
failure The failure callback.

Example

- (void)getOfflinePasswordListAPITest{
    [self.lockAPI getOfflinePasswordListWithDevId:@"6c05de1dbb2e4fef15z4va"
                                          pwdType:@"0,1,9"
                                           status:-1
                                           offset:0
                                            limit:20
                                          success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get the list of time-limited offline temporary passwords

API description

- (void)getReavailableOfflinePasswordWithDevId:(NSString *)devId
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
success The success callback.
failure The failure callback.

Example

- (void)getReavailableOfflinePasswordAPITest{
    [self.lockAPI getReavailableOfflinePasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                                 success:^(id result) {
                        //TODO
    }
                                                 failure:^(NSError *error) {
                        //TODO
    }];
}

Temporary passwords for smart video locks

Get hardware SN of device

API description

Returns the hardware SN of an unlocking method reported by a smart video lock. This hardware SN is used to create unlocking methods, such as a temporary password.

- (void)getVideoLockSnNumberWithDevId:(NSString *)devId
                                 dpId:(NSInteger)dpId
                              success:(ThingSuccessID)success
                              failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
dpId The DP ID of the unlocking method.
success The success callback.
failure The failure callback.

Example

- (void)getVideoLockSnNumberAPITest{
    [self.lockAPI getVideoLockSnNumberWithDevId:@"6c05de1dbb2e4fef15z4va"
                                           dpId:69
                                        success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

Create an online temporary password

API description

- (void)addVideoLockTemporaryPasswordWithDevId:(NSString *)devId
                                          name:(NSString *)name
                                      password:(NSString *)password
                                 effectiveTime:(NSInteger)effectiveTime
                                   invalidTime:(NSInteger)invalidTime
                                     availTime:(NSInteger)availTime
                                            sn:(NSInteger)sn
                                      schedule:(NSString *)schedule
                                      symbolic:(BOOL)symbolic
                                      dpTunnel:(NSInteger)dpTunnel
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
name The name of the password.
password The password content.
effectiveTime The start date and time.
invalidTime The end date and time.
availTime The number of times the password can be used.
sn The ID of the temporary password.
schedule The schedule.
symbolic Specifies whether the DP needs to be sent.
dpTunnel The channel through which the DP is sent. Valid values:
  • 1: The app sends the DP.
  • 2: The cloud sends the DP.
  • 3: The app or cloud sends the DP.
success The success callback.
failure The failure callback.

Example

- (void)addVideoLockTemporaryPasswordAPITest{
    [self.lockAPI addVideoLockTemporaryPasswordWithDevId:@"6c05de1dbb2e4fef15z4va"
                                                    name:@"kandi-1"
                                                password:@"5678212"
                                           effectiveTime:1659333273
                                             invalidTime:1659938073
                                               availTime:0
                                                      sn:41
                                                schedule:@"[{\"allDay\":true,\"effectiveTime\":360,\"invalidTime\":1080,\"workingDay\":127}]"
                                                symbolic:NO
                                                dpTunnel:2
                                                 success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Update an online password

API description

Updates an online password and modifies its start and end date and name.

- (void)updateBLELockTemporaryPasswordWithDevId:(NSString *)devId
                                           name:(NSString *)name
                                       password:(NSString *)password
                                unlockBindingId:(NSInteger )unlockBindingId
                                  effectiveTime:(NSInteger)effectiveTime
                                   invalidTime:(NSInteger)invalidTime
                                          phase:(NSInteger)phase
                                      schedule:(NSString *)schedule
                                      symbolic:(BOOL)symbolic
                                      dpTunnel:(NSInteger)dpTunnel
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
name The name of the password.
password The password content.
unlockBindingId The ID of the password.
effectiveTime The start date and time.
invalidTime The end date and time.
phase Status
  • 2: Normal
  • 4: Frozen
schedule The schedule.
symbolic Specifies whether the DP needs to be sent.
dpTunnel The channel through which the DP is sent. Valid values:
  • 1: The app sends the DP.
  • 2: The cloud sends the DP.
  • 3: The app or cloud sends the DP.
success The success callback.
failure The failure callback.

Example

- (void)updateBLELockTemporaryPasswordAPITest{
    [self.lockAPI updateBLELockTemporaryPasswordWithDevId:@"6c75c3ahtsybmyx7"
                                                     name:@"test"
                                                 password:@"1234567"
                                          unlockBindingId:6071699
                                            effectiveTime:1665306701584
                                              invalidTime:1665316701584
                                                    phase:2
                                                 schedule:@"[{\"allDay\":true,\"effectiveTime\":360,\"invalidTime\":1080,\"workingDay\":127}]"
                                                 symbolic:YES
                                                 dpTunnel:1
                                                  success:^(id result) {
                        //TODO
    }
                                                  failure:^(NSError *error) {
                        //TODO
    }];
}

Update the name of an online password

API description

- (void)updateVideoLockTemporaryPasswordNameWithDevId:(NSString *)devId
                                      unlockBindingId:(NSInteger )unlockBindingId
                                                 name:(NSString *)name
                                              success:(ThingSuccessID)success
                                              failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
unlockBindingId The ID of the password.
name The new name of the password.
success The success callback.
failure The failure callback.

Example

- (void)updateVideoLockTemporaryPasswordNameAPITest{
    [self.lockAPI updateVideoLockTemporaryPasswordNameWithDevId:@"6c05de1dbb2e4fef15z4va"
                                                unlockBindingId:5664269
                                                           name:@"kandi-test-1"
                                                        success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Delete an online temporary password

API description

- (void)deleteVideoLockTemporaryPasswordWithDevId:(NSString *)devId
                                  unlockBindingId:(NSInteger )unlockBindingId
                                         symbolic:(BOOL)symbolic
                                         dpTunnel:(NSInteger)dpTunnel
                                          success:(ThingSuccessID)success
                                          failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
unlockBindingId The ID of the password.
symbolic Specifies whether the DP needs to be sent.
dpTunnel The channel through which the DP is sent. Valid values:
  • 1: The app sends the DP.
  • 2: The cloud sends the DP.
  • 3: The app or cloud sends the DP.
success The success callback.
failure The failure callback.

Example

- (void)deleteVideoLockTemporaryPasswordAPITest{
    [self.lockAPI deleteVideoLockTemporaryPasswordWithDevId:@"6c05de1dbb2e4fef15z4va"
                                            unlockBindingId:5664211
                                                   symbolic:YES
                                                   dpTunnel:1
                                                    success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get an offline temporary password

API description

- (void)addVideoLockOfflinePasswordWithDevId:(NSString *)devId
                                     pwdType:(NSString *)pwdType
                                    gmtStart:(NSInteger)gmtStart
                                  gmtExpired:(NSInteger)gmtExpired
                                     pwdName:(NSString *)pwdName
                                 countryCode:(NSString *)countryCode
                                      mobile:(NSString *)mobile
                                     success:(ThingSuccessID)success
                                     failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
pwdType The type of the password.
  • 0: Unlimited times
  • 1: One-time
  • 9: Clearing code
gmtStart The start date and time.
gmtExpired The end date and time.
pwdName The name of the password.
countryCode The country code of the mobile phone number for the lock user.
mobile The mobile phone number.
success The success callback.
failure The failure callback.

Example

- (void)addVideoLockOfflinePasswordAPITest{
    [self.lockAPI addVideoLockOfflinePasswordWithDevId:@"6c05de1dbb2e4fef15z4va"
                                               pwdType:@"1"
                                              gmtStart:0
                                            gmtExpired:[[NSDate date] timeIntervalSince1970]
                                               pwdName:@"KANDI TEST xxx"
                                           countryCode:@""
                                                mobile:@""
                                               success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Name an offline temporary password

API description

- (void)setVideoLockOfflinePasswordNameWithDevId:(NSString *)devId
                                 unlockBindingId:(NSInteger )unlockBindingId
                                         pwdName:(NSString *)pwdName
                                         success:(ThingSuccessID)success
                                         failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
unlockBindingId The ID of the password.
pwdName The name of the password.
success The success callback.
failure The failure callback.

Example

- (void)setVideoLockOfflinePasswordNameAPITest{
    [self.lockAPI setVideoLockOfflinePasswordNameWithDevId:@"6c05de1dbb2e4fef15z4va"
                                           unlockBindingId:5684380
                                                   pwdName:@"KANDI TEST"
                                                   success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

Get clearing code of offline passwords

API description

- (void)getVideoLockOfflineEmptyCodeWithDevId:(NSString *)devId
                              unlockBindingId:(NSInteger )unlockBindingId
                                         name:(NSString *)name
                                      success:(ThingSuccessID)success
                                      failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
unlockBindingId The ID of the password.
name The name of the clearing code.
success The success callback.
failure The failure callback.

Example

- (void)getVideoLockOfflineEmptyCodeAPITest{
    [self.lockAPI getVideoLockOfflineEmptyCodeWithDevId:@"6c05de1dbb2e4fef15z4va"
                                        unlockBindingId:5694232
                                                   name:@"KANDI TEST"
                                                success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

Get the list of temporary passwords

API description

Returns the list of online and offline passwords.

- (void)getVideoLockTemporaryPasswordWithDevId:(NSString *)devId
                                     authTypes:(NSArray *)authTypes
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
authTypes The authorization type.
success The success callback.
failure The failure callback.

Example

- (void)getVideoLockTemporaryPasswordAPITest{
    [self.lockAPI getVideoLockTemporaryPasswordWithDevId:@"6c05de1dbb2e4fef15z4va"
                                               authTypes:@[@"LOCK_OFFLINE_TEMP_PWD",@"LOCK_TEMP_PWD"]
                                                 success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Member management

Lock members are classified into home members and non-home members (a.k.a. the lock members).

  • Home member: the same as that defined in the Smart Life App SDK. The Smart Lock SDK can be used to associate a lock password ID with a home member account. For more information, see Home Management.

  • Non-home members: an individual member specific to a smart lock, only associated with the lock. This member can be created and assigned. The Smart Lock SDK can be used to associate a lock password ID with this member.

This section describes the operations regarding non-home members.

Add a lock member

API description

Adds a lock panel member. Unlike a home member, a lock member does not need to be registered and is not allowed to manage other devices associated with the current account. A lock member is created to bind an unlocking method with a log entry.

- (void)addPhotoLockPanelMemberWithDevId:(NSString *)devId
                                    name:(NSString *)name
                                  avatar:(NSString *)avatar
                                     sex:(NSString *)sex
                                birthday:(NSInteger)birthday
                                  height:(NSInteger)height
                                  weight:(NSInteger)weight
                         localHeightUnit:(NSString *)localHeightUnit
                                 success:(ThingSuccessID)success
                                 failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
name The username.
avatar The avatar.
sex The gender of the member.
  • 0: Unknown
  • 1: Male
  • 2: Female
birthday The timestamp of the member’s birthday.
height The height of the member.
weight The weight of the member.
localHeightUnit The unit.
  • CM: Centimeter
  • INCH: Inch
success The success callback.
failure The failure callback.

Example

- (void)addPhotoLockPanelMemberAPITest{
    [self.lockAPI addPhotoLockPanelMemberWithDevId:@"6ce91a406cebe66b1f1gep"
                                              name:@"kandi.test"
                                            avatar:@""
                                               sex:@""
                                          birthday:1
                                            height:174
                                            weight:120
                                   localHeightUnit:@"cm"
                                           success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Update member information

API description

Updates the name and avatar of a member.

- (void)updatePhotoLockPanelMemberWithDevId:(NSString *)devId
                                     userId:(NSString *)userId
                                   userName:(NSString *)userName
                                     avatar:(NSString *)avatar
                                    success:(ThingSuccessID)success
                                    failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
userId The user ID.
userName The username.
avatar The avatar.
success The success callback.
failure The failure callback.

Example

- (void)updatePhotoLockPanelMemberAPITest{
    [self.lockAPI updatePhotoLockPanelMemberWithDevId:@"6ce91a406cebe66b1f1gep"
                                               userId:@"000001wt8r"
                                             userName:@"kandi.test.1"
                                               avatar:@""
                                              success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Delete a member

API description

- (void)deletePhotoLockPanelMemberWithDevId:(NSString *)devId
                                     userId:(NSString *)userId
                                    success:(ThingSuccessID)success
                                    failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
userId The user ID.
success The success callback.
failure The failure callback.

Example

- (void)deletePhotoLockPanelMemberAPITest{
    [self.lockAPI deletePhotoLockPanelMemberWithDevId:@"6ce91a406cebe66b1f1gep"
                                               userId:@"000001wt8r"
                                              success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get the list of members

API description

- (void)getPhotoLockMemberPanelListWithDevId:(NSString *)devId
                                     success:(ThingSuccessID)success
                                     failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
success The success callback.
failure The failure callback.

Example

- (void)getPhotoLockMemberPanelListAPITest{
    [self.lockAPI getPhotoLockMemberPanelListWithDevId:@"6ce91a406cebe66b1f1gep"
                                               success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get member details

API description

Returns details of a member.

- (void)getPhotoLockPanelMemberDetailWithDevId:(NSString *)devId
                                        userId:(NSString *)userId
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
userId The user ID.
success The success callback.
failure The failure callback.

Example

- (void)getPhotoLockPanelMemberDetailAPITest{
    [self.lockAPI getPhotoLockPanelMemberDetailWithDevId:@"6ce91a406cebe66b1f1gep"
                                                  userId:@"000001wt8r"
                                                 success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get the number of members

API description

Returns the number of home members and non-home members.

- (void)getPhotoLockMemberCountWithDevId:(NSString *)devId
                                 success:(ThingSuccessID)success
                                 failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
success The success callback.
failure The failure callback.

Example

- (void)getPhotoLockMemberCountAPITest{
    [self.lockAPI getPhotoLockMemberCountWithDevId:@"6ce91a406cebe66b1f1gep"
                                           success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Log management

Get the most recent log entry

API description

- (void)getLatestDeviceLogWithDevId:(NSString *)devId
                           userType:(NSInteger)userType
                             userId:(NSString *)userId
                            success:(ThingSuccessID)success
                            failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
userType The type of the member. Valid values:
  • 0: Home member
  • 1: Lock panel member
userId The user ID.
success The success callback.
failure The failure callback.

Example

- (void)getLatestDeviceLogAPITest{
    [self.lockAPI getLatestDeviceLogWithDevId:@"6ce91a406cebe66b1f1gep"
                                     userType:1
                                       userId:[ThingSmartUser sharedInstance].uid
                                      success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get log entries

API description

Returns the list of log entries.

- (void)getDeviceLogsWithDevId:(NSString *)devId
                 logCategories:(NSString *)logCategories
                       userIds:(NSString *)userIds
           onlyShowMediaRecord:(BOOL)onlyShowMediaRecord
                     startTime:(NSInteger)startTime
                       endTime:(NSInteger)endTime
                    lastRowKey:(NSString *)lastRowKey
                      userType:(NSInteger)userType
                        userId:(NSString *)userId
                         limit:(NSInteger)limit
                       success:(ThingSuccessID)success
                       failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
logCategories The log category.
userIds The list of users in the log entries to be returned.
onlyShowMediaRecord Specifies whether to only return the log entries with images.
startTime The start date and time.
endTime The end date and time.
lastRowKey The parameter for paging.
userType The type of the member. If the value is empty, the type defaults to home member.
  • 0: Home member
  • 1: Lock panel member
userId The ID of the lock panel member.
limit The maximum number of entries returned on each page.
success The success callback.
failure The failure callback.

Example

- (void)getDeviceLogsAPITest{
    // The log category. Operation records: operation. Unlocking records: unlock_record. Locking records: close_record. Alert records: alarm_record.
    [self.lockAPI getDeviceLogsWithDevId:@"6ce91a406cebe66b1f1gep"
                           logCategories:@"unlock_record"
                                 userIds:nil
                     onlyShowMediaRecord:NO
                               startTime:0
                                 endTime:[[NSDate date] timeIntervalSince1970]*1000
                              lastRowKey:nil
                                userType:0
                                  userId:nil
                                   limit:10
                                 success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Bind unlocking records with users

API description

The API method for log management is associated with users by default. This API method is used to bind unlocking records with users.

- (void)bindHistoryLogToUserWithDevId:(NSString *)devId
                               userId:(NSString *)userId
                            unlockIds:(NSArray *)unlockIds
                              success:(ThingSuccessID)success
                              failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
userId The user ID.
unlockIds The list of unlocking methods.
success The success callback.
failure The failure callback.

Example

- (void)bindHistoryLogToUserAPITest{
    [self.lockAPI bindHistoryLogToUserWithDevId:@"6ce91a406cebe66b1f1gep"
                                         userId:[ThingSmartUser sharedInstance].uid
                                      unlockIds:@[@"12-01",@"13-02"]
                                        success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Others

Get rotation angle of a device

API description

- (void)getDeviceRotateWithDevId:(NSString *)devId
                         success:(ThingSuccessID)success
                         failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
success The success callback.
failure The failure callback.

Example

- (void)getDeviceRotateAPITest{
    [self.lockAPI getDeviceRotateWithDevId:@"6ce91a406cebe66b1f1gep"
                                   success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Get the list of albums

API description

- (void)getAlbumListWithDevId:(NSString *)devId
                      success:(ThingSuccessID)success
                      failure:(nullable ThingFailureError)failure;

Parameter description

Parameters Description
devId The device ID.
success The success callback.
failure The failure callback.

Example

- (void)getAlbumListAPITest{
    [self.lockAPI getAlbumListWithDevId:@"6ce91a406cebe66b1f1gep"
                                success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

Destroy

API description

Destroys the allocated resource if a feature is not used. This helps to avoid possible errors. Get the cameraType of the ThingSmartWiFiLockDevice object, and then call the destroy method in ThingSmartCameraType.

Appendix

Camera lock events

Event status Description Status value
Status 1 Anti-pry alert 0x0000
Status 2 Remote unlocking request 0x0001
Status 3 Fingerprint attempt 0x0002
Status 4 Password attempt 0x0003
Status 5 Card attempt 0x0004
Status 6 Face attempt 0x0005
Status 7 Palm print attempt 0x0006
Status 8 Finger vein attempt 0x0007
Status 9 Unlock with fingerprint 0x0008
Status 10 Unlock with password 0x0009
State 11 Unlock with card 0x000A
Status 12 Unlock with face recognition 0x000B
Status 13 Unlock with palm vein 0x000C
Status 14 Unlock with finger vein 0x000D
Status 15 Unlock with temporary password 0x000E
Status 16 Unlock with dynamic password 0x000F
Status 17 Remote unlocking 0x0010
Status 18 Report offline password unlocking 0x0011
Status 19 Report doorbell unlocking 0x0012
Status 20 Duress alarm 0x0013
Status 21 Low battery warning 0x0014
Status 22 Mechanical key attempt 0x0015
Status 23 High temperature alert 0x0016
Status 24 Doorbell ringing and remote unlocking 0x0017
Status 25 Loitering alert 0x0018
Status 26 Lock tampering 0x0019
Status 27 Unlock with special fingerprint 0x001A
Status 28 Unlocking in arm mode 0x001B
Status 29 Unlock with remote control 0x001C