蓝牙门锁接口

更新时间:2021-08-27 11:07:12下载pdf

接口请求方法请使用 TYSdk.apiRequest

添加面板成员

名称

tuya.m.device.member.add

版本

3.0

参数

名称 类型 说明 是否必填
devId String 设备编号
userName String 用户名称
avatar String 头像地址
opmode String 开门方式
timeset String 开门时效(16进制)
timesetType String 时效类型 10. 永久 20.起止 30. 连续
timeZone String 时区

请求示例

{ "devId" : "25230882b4e62d61b52a", "userName" : "tuya", "timesetType" : "10" }

返回示例

{ "result": true, "t": 1550562572623, "success": true, "status": "ok" }

删除面板成员

名称

tuya.m.device.member.remove

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId String 成员编号

请求示例

{ "devId" : "25230882b4e62d61b52a", "userId" : "3765529", }

返回示例

{ "result": true, "t": 1550562572623, "success": true, "status": "ok" }

面板成员升级成家庭成员

名称

tuya.m.device.member.upgrade

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId String 成员编号

请求示例

{ "devId" : "25230882b4e62d61b52a", "userId" : "3765529", }

返回示例

{ "result": true, "t": 1550562572623, "success": true, "status": "ok" }

获取家庭成员列表

名称

tuya.m.device.member.list

版本

4.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号

请求示例

{ "devId" : "25230882b4e62d61b52a", }

返回参数

名称 类型 说明
userId String 成员编号
lockUserId Integer 头锁具用户的id像地址,为0时表示需要手动获取一下
userContact String 用户账号
nickName String 用户名称
avatarUrl String 头像地址
userContact String 联系方式
userType String 用户类型 10. 管理员 20.普通成员. 30. 没有名字的成员
productAttribute Integer 产品权限属性 1 代表有时效权限
supportOpenType supportOpenType[] 支持的开门方式
userTimeSet String 用户的时效设置, base64格式的数据需要转成byte
status Integer 状态: 0失效 1. 有效 2. 待加入

supportOpenType类型

  1. 动态密码权限 2. 蓝牙解锁权限 3. 指纹解锁权限 4, 密码解锁权限 5. 门卡解锁权限 6. 人脸解锁权限 7. 蓝牙钥匙解锁权限

返回示例

{ "result": [{ "userId": "1", "lockUserId":0, "userContact":"86-13757150532", "nickName": "nicky", "avatarUrl": "", "userType" : "1", "supportOpenType":[], "productAttribute": 1, "userTimeSet":"base64", "status": 0 }], "t": 1550562572623, "success": true, "status": "ok" }

获取面板成员列表

名称

tuya.m.device.member.panel.list

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
gid String 家庭编号

返回参数

名称 类型 说明
userId String 成员编号
lockUserId Integer 头锁具用户的id像地址,为0时表示需要手动获取一下
userContact String 用户账号
nickName String 用户名称
avatarUrl String 头像地址
userContact String 联系方式
userType String 用户类型 10. 管理员 20.普通成员. 30. 没有名字的成员
shareUser String 分享用户
shareRelationId Integer 分享关联的id
supportOpenType supportOpenType[] 支持的开门方式
productAttribute Integer 产品权限属性 1 代表有时效权限
userTimeSet String 用户的时效设置, base64格式的数据需要转成byte
status Integer 状态: 0失效 1. 有效 2. 待加入

返回示例

{ "result": [{ "userId": "1", "lockUserId":0, "userContact":"86-13757150532", "nickName": "nicky", "avatarUrl": "", "userType" : "1", / "shareUser": "账号-手机号", "shareRelationId":0, "supportOpenType":[], "productAttribute": 1, "userTimeSet":"base64", "status":0 }], "t": 1550562572623, "success": true, "status": "ok" }

获取登录用户的基础信息

名称

tuya.m.device.member.get

版本

2.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号

请求示例

{ "devId" : "25230882b4e62d61b52a", }

返回参数

名称 类型 说明
userId String 成员编号
lockUserId Integer 头锁具用户的id像地址,为0时表示需要手动获取一下
nickName String 用户名称
avatarUrl String 头像地址
userType String 用户类型 10. 管理员 20.普通成员. 30. 没有名字的成员
supportOpenType supportOpenType[] 支持的开门方式
allOpenType allOpenType[] 当前门锁支持的所有权限
productAttribute Integer 产品权限属性 1 代表有时效权限
phase Integer 冻结状态, 1. 正常 0.冻结
status Integer 状态: 0失效 1. 有效 2. 待加入

返回示例

{ "result": { "userId": "1", "lockUserId":0, "nickName": "nicky", "avatarUrl": "", "userType" : "10", "supportOpenType":[], "allOpenType":[], "productAttribute": 1, "status":0 "phase": 1 }, "t": 1550562572623, "success": true, "status": "ok" }

编辑成员信息

名称

tuya.m.device.member.update

版本

3.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userName String 用户名称
avatar String 头像地址
opmode String 支持的开门权限
timeSet String 开门时效(16进制)
timeSetType String 时效类型 10. 永久 20.起止 30. 连续
timeZone String 时区
userId String 用户ID

返回示例

{ "result": true, "t": 1550562572623, "success": true, "status": "ok" }

查询成员的开门方式(权限和时效详情)

名称

tuya.m.device.member.opmode.get

版本

2.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId String 用户编号

请求示例

{ "devId" : "25230882b4e62d61b52a", "userId" : "3765529",, }

返回示例

{ "result": { "dpSet": [{ "dpId": 1, "status": 0 }, { "dpId": 2, "status": 0 }, { "dpId": 3, "status": 0 },], "timeset": { "type": "1", "timeZone":"+8:00" "settings": "" } }, "t": 1550562572623, "success": true, "status": "ok" }

查询蓝牙用户成员详情

名称

tuya.m.device.member.detail

版本

4.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId String 用户编号

返回参数

名称 类型 说明
userId String 成员编号
avatarUrl String 头像地址
userContact String 用户账号
unlockList unlockList[] 成员拥有的解锁方式列表
userType String 用户类型 10. 管理员 20.普通成员. 30. 没有名字的成员
supportOpenType supportOpenType[] 支持的开门方式
nickName String 用户昵称

返回示例

{ "result":"1", "t":1573024513335, "success":{ "userId":"0001a", "avatarUrl":"", "userContact":"86-13757150532", "unlockList":[ "指纹1", "指纹2", "密码-1" ] }, "status":"ok" }

添加解锁方式

名称

tuya.m.device.member.opmode.add

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId Integer 设备用户id
unlockId Integer 开门方式实际值 这个值是开门方式加开门方式对应的id, 如 1-2 表明开门方式是1, 开门人是2
unlockName Integer 开门方式的名称(可以为空–如果空的话, 命名方式为opmode值 + “_” + 当前数量)

返回示例

{ "result": null, "t": 1550562572623, "success": true, "status": "ok" }

修改解锁方式的名称

名称

tuya.m.device.member.opmode.update

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
opmodeId Integer 开门方式实际值 开门方式列表里的opmodeId字段
unlockName Integer 开门方式的名称(可以为空–如果空的话, 命名方式为opmode值 + “_” + 当前数量)

返回示例

{ "result": true, "t": 1550562572623, "success": true, "status": "ok" }

获取解锁方式列表

名称

tuya.m.device.member.opmode.list

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId String 设备用户id
opmodeId Integer 开门方式实际值 开门方式列表里的opmodeId字段
unlockName Integer 开门方式的名称(可以为空–如果空的话, 命名方式为opmode值 + “_” + 当前数量)

返回参数

名称 类型 说明
devId String 设备id
userId String 设备用户id
opmodeId String 开门方式列表里的opmodeId字段
opmode String 开门方式
opmodeValue Integer 开门方式值, 门锁编号
unlockName String 开门方式所处的状态 10. 待生效,20 生效中,30 创建失败
unlockStatus String 用户昵称
phase Integer 状态: 1. 正常 3.冻结

返回示例

{ "result" : [data], "t" : 1550562572623, "success" : true, "status" : "ok" }

删除解锁方式

名称

tuya.m.device.member.opmode.remove

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId String 设备用户id
opmodeId Integer 开门方式实际值 开门方式列表里的opmodeId字段

返回示例

{ "result": null, "t": 1550562572623, "success": true, "status": "ok" }

获取某个面板用户是否有分享的设备

名称

tuya.m.device.share.user.get

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId String 当前面板用户的id
gid String 家庭组id

返回示例

{ "result": { "userId": "", //用户编号 "userContact":"chemf@tuya.com", //联系方式 }, "t": 1550562572623, "success": true, "status": "ok" }

取消某个锁面板用户的分享

名称

tuya.m.device.member.share.remove

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
shareUserId String 对应面板用户的编号

返回示例

{ "result": true, "t": 1550562572623, "success": true, "status": "ok" }

获取配网持续时间

名称

tuya.m.device.member.share.add

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
countryCode String 国际码
userAccount String 联系方式 (手机或者邮箱号)
shareUserId String 对应面板用户的编号

返回示例

{ "result": true, "t": 1550562572623, "success": true, "status": "ok" }

获取用户在门锁上的编号

名称

tuya.m.device.member.lockid

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
userId String 用户编号

返回示例

{ "result": 12, "t": 1550562572623, "success": true, "status": "ok" }

获取动态密码

名称

tuya.m.device.lock.dynapwd.get

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
adminPwd String 用户的管理密码

返回示例

{ "result": { "dynamicPassword": "73298526" }, "t": 1556342684081, "success": true, "status": "ok" }

设置或取消音箱密码

名称

tuya.m.device.lock.voice.pwd.setting

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
open Boolean 是否开启

请求示例

{ "devId" : "vdevo158462399359867", "open":true, "pwd":"13A63549D7B5272BAF871725219BE325" }

返回示例

{ "result" : true, //是否添加成功, 未返回错误码的情况都是true,可以不用关系这个值 "t" : 1584625900575, "success" : true, "status" : "ok" }

查询音箱密码是否开启

名称

tuya.m.device.lock.voice.pwd.flag

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号

请求示例

{ "devId" : "vdevo158462399359867", }

返回示例

{ "result" : true, // 是否开启, 如果接口返回特殊异常,则默认false "t" : 1584625900575, "success" : true, "status" : "ok" }

获取离线临时密码列表

名称

tuya.m.device.lock.offlinepwd.get

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
pwdType String 密码类型 0.多次使用的密码 1. 单次使用的密码 9. 清空码
gmtStart Integer 开始时间(非多次密码暂时传0)
gmtExpired Integer 结束时间(非多次密码暂时传0)

请求示例

{ "devId" : "vdevo158462399359867" "pwdType" : "1" "gmtStart" : "1568001081" "gmtExpired" : "1578001081" }

返回示例

{ "result" : { "pwd":"1234567890", "pwdId": "3234" },// 离线临时密码 "t" : 1565874044056, "success" : true, "status" : "ok" }

获取一个离线临时密码的删除密码(仅限多次使用的密码)

名称

tuya.m.device.lock.offlinepwd.revoke

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
pwdId String 某个离线密码的编号

请求示例

{ "devId" : "vdevo158462399359867" "pwdId" : "1" }

返回示例

{ "result" : "1234567890",//离线删除密码 "t" : 1565874044056, "success" : true, "status" : "ok" }

设置某个离线密码的名称

名称

tuya.m.device.lock.offlinepwd.name.update

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
pwdId Integer 密码序号
pwdName String 密码名称

请求示例

{ "devId" : "vdevo158462399359867" "pwdId" : "1", "pwdName": "密码名称1", }

返回示例

{ "result" : "1234567890",// 离线删除密码 "t" : 1565874044056, "success" : true, "status" : "ok" }

获取离线临时密码的列表

名称

tuya.m.device.lock.offlinepwd.list

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
pwdType String 密码类型 0.多次使用的密码 1. 单次使用的密码 9. 清空码
status Integer 状态: 查询是 1. 有效 0. 无效
offset Integer 起始记录数
limit Integer 分页大小

请求示例

{ "devId" : "vdevo158462399359867" "pwdType" : "1" "status" : 1, "offset" : 0, "limit" : 50, }

返回参数

名称 类型 说明
pwdId Integer 密码编号
pwdType String 密码类型
pwdName String 密码名称
gmtStart Integer 生效时间
gmtExpired Integer 过期时间
hasClearPwd Boolean 是否设置过清空码
revokedPwdName String 用于清除的密码名称
status Integer 状态:1.已下发,生效中 2. 下发成功 3.已失效

返回示例

{ "result" : [{ "pwdId": 123123, "pwdName": "密码名称1", "pwdType":0, "gmtStart":"1565874044", "gmtExpired":"1575874044", "hasClearPwd":false },{ "pwdId": 23456, "pwdName": "清除单个的密码", "pwdType":8, "gmtStart":"1565874044", "gmtExpired":"1575874044", "revokedPwdName", "密码名称1" }, { "pwdId": 23456, "pwdName": "清空密码", "pwdType":9, "gmtStart":"1565874044", "gmtExpired":"1575874044" }], "t" : 1565874044056, "success" : true, "status" : "ok" }

判断当前类型的密码是否可以继续获取

名称

tuya.m.device.lock.offlinepwd.available

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
pwdType String 0.多次使用的密码 1.单次使用的密码 8. 删除单个的密码 9.清空码

请求示例

{ "devId" : "vdevo158462399359867" "pwdType" : "0" }

返回示例

{ "result" : "false",//是否可以继续获取 "t" : 1565874044056, "success" : true, "status" : "ok" }

获取没有生成过清除码的可以多次使用的离线密码

名称

tuya.m.device.lock.offlinepwd.revocable

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号

请求示例

{ "devId" : "002000015ccf7f0f3c7d" }

返回示例

{ "result" : [{ "pwdId": 012123123, "pwdName": "密码名称1", "gmtStart":"1565874044", "gmtExpired":"1575874044", },{ "pwdId": 083232389, "pwdName": "多次密码1", "gmtStart":"1565874044", "gmtExpired":"1575874044" }], "t" : 1565874044056, "success" : true, "status" : "ok" }

绑定单个清空码的详细信息

名称

tuya.m.device.lock.offlinepwd.bind

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
pwdId Integer 密码序号
pwdName String 名称
mobile String 手机号

请求示例

{ "devId" : "vdevo158462399359867", "pwdId" : 15002, "pwdName" : "绑定名称", "mobile" : "13757150532" }

返回示例

{ "result" : true, "t" : 1565874044056, "success" : true, "status" : "ok" }

远程开门开关(使用设备属性通用功能)

名称

tuya.m.device.props.fetch

版本

2.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
props Integer 属性,远程开门这个属性写死(UNLOCK_PHONE_REMOTE), 通用接口支持多个属性,用逗号隔开

请求示例

{ "devId":"6cc81b7b8fd97fe00fguh2", "props":"\"UNLOCK_PHONE_REMOTE\",\"family_return_warn\"" }

返回示例

{ "UNLOCK_PHONE_REMOTE":"true", "family_return_warn":"false" }

远程开门(网关)

名称

tuya.m.zigbee.lock.remotepwd.execute

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
open Boolean 是否开门

请求示例

{ "devId" : "6c55ebafjnvtwvrr",' "open": true }

返回示例

{ "result" : "1586525839", "t" : 1586529530200, "success" : true, "status" : "ok" }

用户获取设备自身的激活时间(配网时间)

名称

tuya.m.device.active.date

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号

请求示例

{ "devId" : "6c55ebafjnvtwvrr" }

返回示例

{ "result" : "1586525839", "t" : 1586529530200, "success" : true, "status" : "ok" }

用户获取设备的激活时间(配网时间)

名称

tuya.m.device.opmode.sync.rise

版本

2.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
dpIds [] DP, 数据[12, 13]

请求示例

{ "devId" : "6c55ebafjnvtwvrr", "dpId" : [12,13] }

返回示例

{ "result": { "ins": "010003fd02fd05fd040006fd08fd07fd09fd", //下发门锁的开锁方式校验串 "distributed": true, //只有当该值为true时,才可以发起同步指令 "dpId":54, //下发的DP }, "t": 1550562572623, "success": true, "status": "ok" }

获取在线临时密码列表

名称

tuya.m.device.lock.temppwd.list

版本

3.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
availTime Integer 可用次数(0. 永久, 1. 单次) 是, 不传次参数则显示设备下的所有可用的临时密码

请求示例

{ "devId" : "6cc1483v89yz1t8o", }

返回参数

名称 类型 说明
id Integer 序号
name String 密码名称
effective Integer 密码状态 1. 待生效 2。 待下发 3. 使用中 4. 待删除 5. 已过期
scheduleDetails String 定时数据json格式字符串
phone String 电话
countryCode String 国家码
effectiveTime Long 生效时间
invalidTime Long 失效时间
availTime Integer 可用次数 0、永久,1、一次性

返回示例

{ "result": [{ "id": 11, "effective": 3, "effectiveTime": 111, "invalidTime": 333, "name": "name", "phone": "phone", "scheduleDetails": [{ "allDay": true, "effectiveTime": 720, "invalidTime": 1080, "workingDay": 8 //星期用一个字节来表示,bit0 ~ bit6 分别代表周日~周六 }], }], "t": 1550562572623, "success": true, "status": "ok" }

添加在线临时密码列表

名称

tuya.m.device.lock.temppwd.create

版本

5.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
password String 临时密码
schedule Integer 定时数据json格式字符串
phone String 电话
countryCode String 国家码
effectiveTime Long 生效时间
invalidTime Long 失效时间
name String 密码名称
availTime Integer 可用次数 0、永久,1、一次性
sn Integer 临时密码编号

请求示例

{ "devId" : "vdevo158313195425051" "countryCode" : "86", "availTime" : 1, "invalidTime" : 1588133004, "name" : "沽湖时区验证4.0", "effectiveTime" : 1588132904, "schedule":"", "phone" : "15158064461", "password" : "2E478FEBBDBE029F9B091FDC9E5CB8F9", }

schedule参数格式示例

[{
     
    "allDay": true, //是否全天
    "effectiveTime": 720, //生效时间
    "invalidTime": 1080, //失效时间
    "workingDay":   //星期用一个字节来表示,bit0 ~ bit6 分别代表周日~周六
}, {
     
    "allDay": true,
    "effectiveTime": 720,
    "invalidTime": 1080,
    "workingDay": 3
}]

返回示例

{ "result":true, "t":1589370119582, "success":true, "status":"ok" }

更新临时密码

名称

tuya.m.device.lock.temppwd.update

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
password String 临时密码
schedule String 定时数据json格式字符串
phone String 电话
countryCode String 国家码
effectiveTime Long 生效时间
availTime Integer 可用次数 0、永久,1、一次性
name String 名称
invalidTime Long 失效时间

schedule参数格式实例

[{
     
    "allDay": true, //是否全天
    "effectiveTime": 720, //生效时间
    "invalidTime": 1080, //失效时间
    "workingDay":   //星期用一个字节来表示,bit0 ~ bit6 分别代表周日~周六
}, {
     
    "allDay": true,
    "effectiveTime": 720,
    "invalidTime": 1080,
    "workingDay": 3
}]

删除门锁临时密码(删除记录,界面将不显示)

名称

tuya.m.device.lock.temppwd.remove

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
pwdId Integer 解锁方式id

请求示例

{ "devId" : "6cc1483v89yz1t8o", "pwdId" : 2, }

返回示例

{ "result":true, "t":1589370119582, "success":true, "status":"ok" }

校验临时密码添加是否有效

名称

tuya.m.device.lock.temppwd.validate

版本

1.0

请求参数

名称 类型 说明 是否必填
devId String 设备编号
password String 临时密码
schedule String 定时数据json格式字符串
phone String 电话
countryCode String 国家码
effectiveTime Long 生效时间
name String 名称
invalidTime Long 失效时间

返回示例

{ "result" : "false",//是否可以继续获取 "t" : 1565874044056, "success" : true, "status" : "ok" }