门锁基础 API

更新时间:2023-06-07 02:34:06

门锁基础 API 封装离线密码、在线密码、成员管理等常用方法,适用于拍照锁、可视对讲门锁等设备。

功能简介

类名 说明
TuyaSmartLockApi 门锁基础 API 封装类

离线密码

接口说明

判断当前类型的密码是否可以继续获取,适用于拍照锁和可视对讲锁。

- (void)isCurrentOfflinePasswordAvailableWithDevId:(NSString *)devId
                                           pwdType:(NSInteger)pwdType
                                           success:(TYSuccessID)success
                                           failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdType 密码类型:
  • 0:多次
  • 1:单次
  • 9:清空密码
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

获取离线密码列表,适用于拍照锁和可视对讲锁。

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

参数说明

参数 说明
devId 设备 ID
pwdType 密码类型:
  • 0:多次
  • 1:单次
  • 9:清空密码
status 密码状态:
  • 1:已生成,待使用
  • 0:已使用过一次
  • -1:失效
offset 页码
limit 记录数(默认值:50
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

获取可分配的不限次数离线密码,适用于拍照锁和可视对讲锁。

- (void)getReavailableOfflinePasswordWithDevId:(NSString *)devId
                                       success:(TYSuccessID)success
                                       failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

添加离线临时密码。只针对拍照锁,产品 code:wf_jtmspro

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

参数说明

参数 说明
devId 设备 ID
pwdType 密码类型:
  • 0:多次
  • 1:单次
  • 9:清空密码
gmtStart 开始时间
gmtExpired 结束时间
pwdName 密码名称
countryCode 手机号的国家码
mobile 手机号
success 接口成功回调
failure 接口失败回调

示例代码

- (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
    }];
}

接口说明

设置离线密码名称。只针对拍照锁,产品 code:wf_jtmspro

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

参数说明

参数 说明
devId 设备 ID
pwdId 密码编号
pwdName 密码名称
mobile 手机号
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

获取某个离线临时密码的清空码。只针对拍照锁,产品 code:wf_jtmspro

- (void)getPhotoLockOfflineEmptyCodeWithDevId:(NSString *)devId
                                        pwdId:(NSInteger )pwdId
                                      success:(TYSuccessID)success
                                      failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdId 密码编号
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

添加离线临时密码。只针对可视对讲门锁,产品 code:videolock_1w_1

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

参数说明

参数 说明
devId 设备 ID
pwdType 密码类型:
  • 0:多次
  • 1:单次
  • 9:清空密码
gmtStart 开始时间
gmtExpired 结束时间
pwdName 密码名称
countryCode 手机号的国家码
mobile 手机号
success 接口成功回调
failure 接口失败回调

示例代码

- (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
    }];
}

接口说明

设置离线密码名称。只针对可视对讲门锁,产品 code:videolock_1w_1

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

参数说明

参数 说明
devId 设备 ID
unlockBindingId 密码编号
pwdName 密码名称
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

获取某个离线临时密码的清空码。只针对可视对讲门锁,产品 code:videolock_1w_1

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

参数说明

参数 说明
devId 设备 ID
unlockBindingId 密码编号
name 离线删除密码的名称
success 接口成功回调
failure 接口失败回调

示例代码

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

在线密码

接口说明

获取在线临时密码列表。只针对拍照锁,产品 code:wf_jtmspro

- (void)getPhotoLockTemporaryPasswordWithDevId:(NSString *)devId
                                       success:(TYSuccessID)success
                                       failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

获取可视对讲门锁硬件设备编号 sn。只针对可视对讲门锁,产品 code:videolock_1w_1

- (void)getVideoLockSnNumberWithDevId:(NSString *)devId
                                 dpId:(NSInteger)dpId
                              success:(TYSuccessID)success
                              failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
dpId 开门方式 dpId
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

获取在线临时密码列表。只针对可视对讲门锁,产品 code:videolock_1w_1

- (void)getVideoLockTemporaryPasswordWithDevId:(NSString *)devId
                                     authTypes:(NSArray *)authTypes
                                       success:(TYSuccessID)success
                                       failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
authTypes 查询的授权类型
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

添加在线临时密码。只针对拍照锁,产品 code:wf_jtmspro

- (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:(TYSuccessID)success
                                       failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 密码名称
phone 手机号
effectiveTime 生效时间
invalidTime 失效时间
password 密码
schedule 周期
countryCode 手机号的国家码
availTime 可用次数
success 接口成功回调
failure 接口失败回调

示例代码

- (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
    }];
}

接口说明

添加在线临时密码。只针对可视对讲门锁,产品 code:videolock_1w_1

- (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:(TYSuccessID)success
                                       failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 密码名称
password 密码内容
effectiveTime 生效时间
invalidTime 失效时间
availTime 可用次数
sn 临时密码编号
schedule 周期
symbolic 是否需要下发 DP
dpTunnel 如果需要下发 DP,当前需要走的 DP 下发通道:
  • 1:App 下发
  • 2:云端下发
  • 3:混合下发
success 接口成功回调
failure 接口失败回调

示例代码

- (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
    }];
}

接口说明

更新临时密码名称。只针对拍照锁,产品 code:wf_jtmspro

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

参数说明

参数 说明
devId 设备 ID
pwdId 密码编号
name 名称
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

更新临时密码名称。只针对可视对讲门锁,产品 code:videolock_1w_1

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

参数说明

参数 说明
devId 设备 ID
unlockBindingId 密码编号
name 名称
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

删除临时密码。针对拍照锁和旧版公版门锁,产品 code:wf_jtmsprowf_ms

- (void)deletePhotoLockTemporaryPasswordWithDevId:(NSString *)devId
                                            pwdId:(NSInteger )pwdId
                                          success:(TYSuccessID)success
                                          failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdId 密码编号
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

删除临时密码。只针对可视对讲门锁,产品 code:videolock_1w_1

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

参数说明

参数 说明
devId 设备 ID
unlockBindingId 密码编号
symbolic 是否需要下发 DP
dpTunnel 如果需要下发 DP,当前需要走的 DP 下发通道:
  • 1:App 下发
  • 2:云端下发
  • 3:混合下发
success 接口成功回调
failure 接口失败回调

示例代码

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

成员管理

接口说明

统计成员个数。只针对拍照锁,产品 code:wf_jtmspro

- (void)getPhotoLockMemberCountWithDevId:(NSString *)devId
                                 success:(TYSuccessID)success
                                 failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

查询面板成员列表。只针对拍照锁,产品 code:wf_jtmspro

- (void)getPhotoLockMemberPanelListWithDevId:(NSString *)devId
                                     success:(TYSuccessID)success
                                     failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

添加面板成员。只针对拍照锁,产品 code:wf_jtmspro

- (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:(TYSuccessID)success
                                 failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 用户名称
avatar 头像信息
sex 性别:
  • 0:未知
  • 1:男
  • 2:女
birthday 生日(时间戳)
height 身高
weight 体重
localHeightUnit 单位:
  • CM:厘米
  • INCH:英寸
success 接口成功回调
failure 接口失败回调

示例代码

- (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
    }];
}

接口说明

更新面板成员信息。只针对拍照锁,产品 code:wf_jtmspro

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

参数说明

参数 说明
devId 设备 ID
userId 用户编号
userName 用户名称
avatar 头像信息
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

删除面板成员信息。只针对拍照锁,产品 code:wf_jtmspro

- (void)deletePhotoLockPanelMemberWithDevId:(NSString *)devId
                                     userId:(NSString *)userId
                                    success:(TYSuccessID)success
                                    failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
userId 用户编号
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

获取面板成员详情。只针对拍照锁,产品 code:wf_jtmspro

- (void)getPhotoLockPanelMemberDetailWithDevId:(NSString *)devId
                                        userId:(NSString *)userId
                                       success:(TYSuccessID)success
                                       failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
userId 用户编号
success 接口成功回调
failure 接口失败回调

示例代码

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

其他

接口说明

发起同步门锁的解锁方式。

- (void)syncDataWithDevId:(NSString *)devId
                    dpIds:(NSArray<NSString *> *)dpIds
                  success:(TYSuccessID)success
                  failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
dpIds 需要同步的解锁方式类型列表(数组数字)
success 接口成功回调
failure 接口失败回调

示例代码

- (void)syncDataAPITest{
    [self.lockAPI syncDataWithDevId:@"6cc849sydtyuum28"
                              dpIds:@[@"12",@"15"]
                            success:^(id result) {
						//TODO
    } failure:^(NSError *error) {
						//TODO
    }];
}

接口说明

查询是否设置远程语音解锁。

- (void)isSetRemoteVoiceUnlockWithDevId:(NSString *)devId
                                success:(TYSuccessID)success
                                failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

关闭或打开远程语音解锁,并设置语音密码。更新密码也采用此接口。

- (void)setRemoteVoiceUnlockWithDevId:(NSString *)devId
                                 open:(BOOL)open
                                  pwd:(NSString *)pwd
                              success:(TYSuccessID)success
                              failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
open 是否开启
pwd 音响开门密码
success 接口成功回调
failure 接口失败回调

示例代码

- (void)setRemoteVoiceUnlockAPITest{
    [self.lockAPI setRemoteVoiceUnlockWithDevId:@"6cc849sydtyuum28"
                                           open:YES
                                            pwd:@"4324"
                                        success:^(id result) {
						//TODO
    } failure:^(NSError *error) {
						//TODO
    }];
}

接口说明

获取设备旋转角度。

- (void)getDeviceRotateWithDevId:(NSString *)devId
                         success:(TYSuccessID)success
                         failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

获取相册列表,只适用于可视对讲类门锁。

- (void)getAlbumListWithDevId:(NSString *)devId
                      success:(TYSuccessID)success
                      failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

查询最近一条日志记录。

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

参数说明

参数 说明
devId 设备 ID
userType 用户体系类型:
  • 0:家庭体系
  • 1:面板用户体系
userId 用户编号
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

查询日志记录。

- (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:(TYSuccessID)success
                       failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
logCategories 日志大类
userIds 需要筛选的用户列表
onlyShowMediaRecord 是否筛选带图像的记录
startTime 开始时间
endTime 结束时间
lastRowKey 查询分页的参数
userType 用户体系类型:
  • 0:家庭体系
  • 1:面板用户体系
userId 面板用户编号
limit 每页数据个数
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getDeviceLogsAPITest{
    // 日志大类。操作日志:operation;开门记录:unlock_record;关门记录:close_record;告警记录: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
    }];
}

接口说明

绑定历史记录到用户。

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

参数说明

参数 说明
devId 设备 ID
userId 用户 ID
unlockIds 解锁方式列表
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

是否可以远程开门。

- (void)remoteUnlockAvailableWithDevId:(NSString *)devId
                               success:(TYSuccessID)success
                               failure:(TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

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

接口说明

更新自定义临时密码的信息。

- (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:(TYSuccessID)success
                                       failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 密码名称
password 密码内容
unlockBindingId 密码编号
effectiveTime 生效时间
invalidTime 失效时间
phase 密码状态。2:正常;4:冻结
schedule 周期
symbolic 是否需要下发dp
dpTunnel 如果需要下发 DP,当前需要走的 DP 下发通道。1:App 下发;2:云端下发;3:混合下发
success 接口成功回调
failure 接口失败回调

示例代码

- (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
    }];
}

接口说明

校验临时密码参数的有效性。

- (void)validateBLELockTemporaryPasswordWithDevId:(NSString *)devId
                                             name:(NSString *)name
                                            phone:(NSString *)phone
                                  unlockBindingId:(NSInteger)unlockBindingId
                                    effectiveTime:(NSInteger)effectiveTime
                                      invalidTime:(NSInteger)invalidTime
                                         password:(NSString *)password
                                         schedule:(NSString *)schedule
                                      countryCode:(NSString *)countryCode
                                          success:(TYSuccessID)success
                                          failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 密码名称
phone 手机号
unlockBindingId 密码编号
effectiveTime 生效时间
invalidTime 失效时间
password 密码
schedule 周期
countryCode 手机的国家码
success 接口成功回调
failure 接口失败回调

示例代码

- (void)validateBLELockTemporaryPasswordAPITest{
    [self.lockAPI validateBLELockTemporaryPasswordWithDevId:@"6c75c3ahtsybmyx7"
                                                       name:@"kandi-ttt"
                                                      phone:@"13625814876"
                                            unlockBindingId:6072231
                                              effectiveTime:1665306701584
                                                invalidTime:1665316701584
                                                   password:@"123456"
                                                   schedule:@"[{\"allDay\":true,\"effectiveTime\":360,\"invalidTime\":1080,\"workingDay\":127}]"
                                                countryCode:@"86"
                                                    success:^(id result) {
						//TODO
    }                                               failure:^(NSError *error) {
						//TODO
    }];
}

接口说明

上报操作日志记录。

- (void)uploadBLELockOperationLogWithDevId:(NSString *)devId
                                   logType:(NSString *)logType
                                      data:(NSString *)data
                                   success:(TYSuccessID)success
                                   failure:(nullable TYFailureError)failure;

参数说明

参数 说明
devId 设备 ID
logType 日志类型
data 业务参数
success 接口成功回调
failure 接口失败回调

示例代码

- (void)uploadBLELockOperationLogAPITest{
    [self.lockAPI uploadBLELockOperationLogWithDevId:@"6c75c3ahtsybmyx7"
                                             logType:@"remote_unlock_setting"
                                                data:@[@(NO)].tysdk_JSONString
                                             success:^(id result) {
						//TODO
    } failure:^(NSError *error) {
						//TODO
    }];
}