W89(WiFi/4G联网锁)
点击展开
点击展开查看接口信息
1.注册(与appid绑定)
简要描述
将设备和appid、appsecret绑定
请求URL
https://wdev.wmj.com.cn/deviceApi/register
请求方式
POST
请求格式
json
参数
{
"app_id": "",
"app_secret": "",
"device_sn": ""
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 用户app_id |
app_secret | 是 | string | 用户app_secret |
device_sn | 是 | string | 设备序列号 |
返回示例
{
"code": 0,
"msg": "注册成功"
}
{
"code": 1005,
"msg": "设备已注册"
}
返回参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | int | 错误码 0成功其他异常 |
msg | int | 描述 |
备注
更多返回错误代码请看首页的错误代码描述
2.激活(退出演示模式)
简要描述
激活设备,默认情况下,设备是演示模式(按#键即可开门),激活设备后进入正常模式
请求URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
请求格式
json
参数
{
"app_id":"",
"app_secret":"",
"device_sn": "设备序列号",
"data": {
"cmd_type": "active",
"data": {
"admin_pwd": "031541",
"device_cid": "23032920472883333792"
}
}
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 用户app_id |
app_secret | 是 | string | 用户app_secret |
device_sn | 是 | string | 设备序列号 |
data.cmd_type | 是 | string | 激活控制标识active |
data.data.admin_pwd | 是 | string | 激活码,自定义5位数字在前一位补0 |
data.data.device_cid | 是 | string | cid,自定义20位数字 |
返回示例
//成功
{
"code": 0,
"data": {
"device_sn": "W89601EBA84",
"msg_id": 898,
"type": 1,
"cmd": "active",
"info": {
"err_code": 0,
"status": 1,
"wifi_rssi": -26
}
}
}
//失败
{
"code": 0,
"data": {
"device_sn": "W89601EBA84",
"msg_id": 899,
"type": 1,
"cmd": "active",
"info": {
"err_code": 255,
"status": 0,
"wifi_rssi": -26
}
}
}
返回参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | int | 错误码 0成功其他异常 |
data.info.err_code | int | 0成功,17为已激活过,其他异常 |
data.info.wifi_rssi | int | 设备信号 |
3.远程开锁
简要描述
开锁,由于是低功耗方案,WiFi的开窗时间和MQTT开窗时间默认3秒,如果要响应速度加快,需调整WiFi开窗时间和MQTT开窗时间,但电池续航时间会受影响。
请求URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
请求格式
json
参数
{
"app_id":"",
"app_secret":"",
"device_sn": "设备序列号",
"type": 1,
"data": {
"cmd_type": "open"
}
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 用户app_id |
app_secret | 是 | string | 用户app_secret |
device_sn | 是 | string | 设备序列号 |
data.device_cid | 是 | string | 未激活默认数据FFFFFFFFFFFFFFFFFFFF |
data.cmd_type | 是 | string | 开锁标识cmd_type |
data.data.user_type | 是 | string | minipro |
返回示例
//成功
{
"device_sn": "W89601EBA89",
"type": 1,
"msg_id": 140,
"cmd": "open",
"info": {
"status": 1,
"err_code": 0,
"wifi_rssi": -35
}
}
//失败
{
"code": 1001,
"msg": "网络超时"
}
返回参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | int | 错误码 0成功其他异常 |
data.info.err_code | int | 0成功其他异常 |
data.info.wifi_rssi | int | 设备信号 |
4.查询在线状态
简要描述
查询设备在线状态
请求URL
https://wdev.wmj.com.cn/deviceApi/getOnLine
请求方式
POST
请求格式
json
参数
{
"app_id": "",
"app_secret": "",
"device_sn": ""
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 用户app_id |
app_secret | 是 | string | 用户app_secret |
device_sn | 是 | string | 设备序列号 |
返回示例
{
"code": 0,
"data": {
"on_line": 0
},
"msg": "查询成功"
}
返回参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | int | 错误码 0成功其他异常 |
msg | int | 描述 |
on_line | int | 值为1在线,值为0离线 |
备注
更多返回错误代码请看首页的错误代码描述
5.门卡管理
简要描述
卡管理:
添加
、删除
、修改
、查询
、清空
、获取卡总数
请求URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
请求格式
json
请求示例
{
"app_id":"",
"app_secret":"",
"device_sn": "W89*******",
"data": {
"cmd_type": "card_***",
"data": {
"card_id": "27598faf",
"start_time": 1676904446,
"end_time": 1710662359
}
}
}
参数说明
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 接口参数:用户app_id |
app_secret | 是 | string | 接口参数:用户app_secret |
device_sn | 是 | string | 接口参数:设备序列号 |
data.cmd_type | 是 | string | 业务参数:命令类型 card_add: 新增 card_del: 删除 card_edit: 编辑 card_clr: 清空所有卡 card_sum: 获取卡总数 card_info_by_id: 获取卡详情 |
*data.data.card_id * | 是 | string | 业务参数:卡序列号 |
data.data.start_time | 否 | integer | 业务参数: 启用时间,默认当前时间 |
data.data.end_time | 否 | integer | 业务参数: 停用时间,默认0x7FFFFFFF |
返回示例
//接口调用成功
{
"code": 0,
"data": {
"device_sn": "W89*******",
"cmd_type": "card_***",
"info": {
"card_id": "DB948509",
"end_time": 1810662359,
"err_code": 0,
"rssi": -14,
"start_time": 1676904446,
}
}
}
//接口调用失败
{
"code": 1001,
"msg": "网络超时"
}
返回参数说明
参数名 | 必有 | 类型 | 说明 |
---|---|---|---|
code | 是 | int | 接口参数:错误码 0: 成功 其他: 异常 |
data.info.err_code | 是 | int | 业务参数: 0: 成功 其他: 失败 17: 卡已存在 19: 卡不存在 |
data.info.rssi | 是 | int | 业务参数:设备信号 |
data.info.card_id | 否 | string | 业务参数:卡序列号 |
data.info.start_time | 否 | int | 业务参数:启用时间 |
data.info.end_time | 否 | int | 业务参数:停用时间 |
6.固定密码管理
简要描述
密码管理:
添加
、删除
、修改
、查询
、清空
、获取密码总数
请求URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
请求格式
json
参数
{
"app_id":"",
"app_secret":"",
"device_sn": "W89*******",
"data": {
"cmd_type": "pwd_***",
"data": {
"pwd": "12345687",
"start_time": 0,
"end_time": 1676904446
}
}
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 接口参数:用户app_id |
app_secret | 是 | string | 接口参数:用户app_secret |
device_sn | 是 | string | 接口参数:设备序列号 |
data.cmd_type | 是 | string | 业务参数:命令类型 pwd_add: 新增 pwd_del: 删除 pwd_edit: 编辑 pwd_clr: 清空所有密码 pwd_sum: 获取密码总数 pwd_info_by_id: 获取密码详情 |
data.data.pwd | 是 | string | 业务参数:不大于8位密码 |
data.data.start_time | 否 | integer | 业务参数:启用时间,默认当前时间 |
data.data.end_time | 否 | integer | 业务参数:停用时间,默认0x7FFFFFFF |
返回示例
//接口调用成功
{
"code": 0,
"data": {
"device_sn": "W89******",
"cmd_type": "pwd_***",
"info": {
"end_time": 1718771237,
"err_code": 0,
"pwd": "12345687",
"rssi": -29,
"start_time": 0,
}
}
}
//接口调用失败
{
"code": 1001,
"msg": "网络超时"
}
返回参数说明
参数名 | 必有 | 类型 | 说明 |
---|---|---|---|
code | 是 | int | 接口参数:错误码 0: 成功 其他: 异常 |
data.info.err_code | 是 | int | 业务参数: 0: 成功 其他: 失败 17: 密码已存在 18: 密码不存在 |
data.info.rssi | 是 | int | 业务参数:设备信号 |
data.info.pwd | 否 | string | 业务参数:密码 |
data.info.start_time | 否 | int | 业务参数:启用时间 |
data.info.end_time | 否 | int | 业务参数:停用时间 |
案例
1.添加密码
发送
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"device_sn": "W89601E9AC2",
"data": {
"cmd_type": "pwd_add",
"data": {
"pwd": "1212"
}
}
}
返回
{
"code": 0,
"data": {
"device_sn": "W89601E9AC2",
"msg_id": 7431,
"type": 1,
"cmd": "",
"app_id": "",
"cmd_type": "pwd_add",
"info": {
"err_code": 0,
"rssi": -45,
"status": 1
}
}
}
2.编辑密码的开始时间和结束时间
发送
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"device_sn": "W89601E9AC2",
"data": {
"cmd_type": "pwd_edit",
"data": {
"pwd": "1212",
"start_time": 0,//开始时间
"end_time": 1718770429//结束时间,时间戳秒
}
}
}
返回
{
"code": 0,
"data": {
"device_sn": "W89601E9AC2",
"msg_id": 7921,
"type": 1,
"cmd": "",
"app_id": "",
"cmd_type": "pwd_edit",
"info": {
"err_code": 0,
"rssi": -42,
"status": 1
}
}
}
3.读取密码的有效期
发送
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"device_sn": "W89601E9AC2",
"data": {
"cmd_type": "pwd_info_by_id",
"data": {
"pwd": "1212",
}
}
}
返回
{
"code": 0,
"data": {
"device_sn": "W89601E9AC2",
"msg_id": 8113,
"type": 1,
"cmd": "",
"app_id": "",
"cmd_type": "pwd_info_by_id",
"info": {
"end_time": 1718770429,
"err_code": 0,
"pwd": "1212",
"rssi": -40,
"start_time": 0,
"status": 1
}
}
}
4.删除密码
发送
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"device_sn": "W89601E9AC2",
"data": {
"cmd_type": "pwd_del",
"data": {
"pwd": "1212"
}
}
}
返回
{
"code": 0,
"data": {
"device_sn": "W89601E9AC2",
"msg_id": 8241,
"type": 1,
"cmd": "",
"app_id": "",
"cmd_type": "pwd_sum",
"info": {
"err_code": 0,
"pwd_sum": 6,
"rssi": -41,
"status": 1
}
}
}
5.获取密码总数
发送
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"device_sn": "W89601E9AC2",
"data": {
"cmd_type": "pwd_sum",
"data": {
"data": {}
}
}
}
返回
{
"code": 0,
"data": {
"device_sn": "W89601E9AC2",
"msg_id": 8241,
"type": 1,
"cmd": "",
"app_id": "",
"cmd_type": "pwd_sum",
"info": {
"err_code": 0,
"pwd_sum": 6,
"rssi": -41,
"status": 1
}
}
}
6.清空密码
发送
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"device_sn": "W89601E9AC2",
"data": {
"cmd_type": "pwd_clr",
"data": {}
}
}
返回
{
"code": 0,
"data": {
"device_sn": "W89601E9AC2",
"msg_id": 8456,
"type": 1,
"cmd": "",
"app_id": "",
"cmd_type": "pwd_clr",
"info": {
"err_code": 0,
"rssi": -40,
"status": 1
}
}
}
7.临时密码
简要描述
获取离线临时密码
请求URL
https://wdev.wmj.com.cn/deviceApi/wifiLock/temporaryPassword
请求方式
POST
请求格式
json
参数
{
"app_id": "",
"app_secret": "",
"device_sn": "W89601EC675",
"data": {
"device_cid": "88888888888888888888",//激活锁时设置的device_cid
"admin_pw": "123456"//激活锁时设置的激活密码,这个密码并不是开门的密码
}
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 用户app_id |
app_secret | 是 | string | 用户app_secret |
device_sn | 是 | string | 设备序列号 |
data.device_cid | 是 | string | 激活设置的cid |
data.admin_pw | 是 | string | 激活时设置的密码(6位)这个密码并不是开门的密码 |
返回示例
//成功
{
"code": 0,
"data": {
"pwd": "26719346"//生成的离线密码,因为大多数前端小程序脚本都容易被逆向,为了保证安全,只能从服务器生成。
}
}
//失败
{
"code": 1001,
"msg": "网络超时"
}
返回参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | int | 错误码 0成功其他异常 |
data.pwd | string | 离线密码 |
8.指纹管理
简要描述
指纹管理:
添加
、删除
、修改
、查询
、清空
、获取指纹总数
请求URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
请求格式
json
参数
{
"app_id": "",
"app_secret": "",
"device_sn": "W89*****",
"time_out":60,
"data": {
"cmd_type": "fp_***",
"data": {
"start_time": 1676904446,
"end_time": 1676904446
}
}
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 接口参数:用户app_id |
app_secret | 是 | string | 接口参数:用户app_secret |
device_sn | 是 | string | 接口参数:设备序列号 |
time_out | 否 | string | 接口参数:* 超时时间,单位秒,不填默认15秒,添加指纹比较耗时可以填写60秒 * |
data.cmd_type | 是 | string | 业务参数:命令类型 fp_add: 新增 fp_del: 删除 fp_edit: 编辑 fp_clr: 清空所有指纹 fp_sum: 获取指纹总数 fp_info_by_id: 获取指纹详情 |
data.data.fp_id | * fp_add:否 其他:是* | integer | 业务参数:指纹id,添加时返回 |
data.data.start_time | 否 | integer | 业务参数: 启用时间,默认当前时间 |
data.data.end_time | 否 | integer | 业务参数: 停用时间,默认0x7FFFFFFF |
返回示例
//接口调用成功
{
"code": 0,
"data": {
"device_sn": "W89*****",
"cmd_type": "fp_****",
"info": {
"end_time": 1719303537,
"err_code": 0,
"fp_id": 0,
"rssi": -16,
"start_time": 0,
}
}
}
//接口调用失败
{
"code": 1001,
"msg": "网络超时"
}
返回参数说明
参数名 | 必有 | 类型 | 说明 |
---|---|---|---|
code | 是 | int | 接口参数:错误码 0: 成功 其他: 异常 |
data.info.err_code | 是 | int | 业务参数: 0: 成功 其他: 失败 17: 指纹已存在 |
data.info.rssi | 是 | int | 业务参数:设备信号 |
data.data.fp_id | 否 | string | 业务参数:指纹id |
data.data.start_time | 否 | integer | 业务参数:启用时间 |
data.data.end_time | 否 | integer | 业务参数:停用时间 |
9.设置常开常锁模式
1. 设置锁常开、常闭模式
简要描述
某些场景下,需要将门保持常开状态,不用验证方便进出。如:共享教室、会议室等场景使用时段设置常开,方便进出。
请求URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
请求格式
json
请求示例
{
"app_id":"",
"app_secret":"",
"device_sn": "W89*******",
"data":{
"cmd_type": "set_nonc",
"data": {
"type": 1
}
}
}
}
参数说明
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 接口参数:用户app_id |
app_secret | 是 | string | 接口参数:用户app_secret |
device_sn | 是 | string | 接口参数:设备序列号 |
data.cmd_type | 是 | string | 业务参数:命令类型 set_nonc: 设置锁模式 |
*data.data.type * | 是 | string | 业务参数: 1: 常闭 0: 常开 |
返回示例
//接口调用成功
{
"code": 0,
"data": {
"device_sn": "W89******",
"cmd_type": "set_nonc",
"info": {
"err_code": 0,
"rssi": -19,
}
}
}
//接口调用失败
{
"code": 1001,
"msg": "网络超时"
}
返回参数说明
参数名 | 必有 | 类型 | 说明 |
---|---|---|---|
code | 是 | int | 接口参数:错误码 0: 成功 其他: 异常 |
data.info.err_code | 是 | int | 业务参数: 0: 成功 其他: 失败 |
data.info.rssi | 是 | int | 业务参数:设备信号 |
2. 获取锁常开、常闭模式
简要描述
设置锁常开、常闭模式
请求URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
请求格式
json
请求示例
{
"app_id":"",
"app_secret":"",
"device_sn": "W89*******",
"data":{
"cmd_type": "get_nonc",
"data": {}
}
}
}
参数说明
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 接口参数:用户app_id |
app_secret | 是 | string | 接口参数:用户app_secret |
device_sn | 是 | string | 接口参数:设备序列号 |
data.cmd_type | 是 | string | 业务参数:命令类型 get_nonc: 获取锁模式 |
*data.data * | 是 | object | 业务参数:{} |
返回示例
//接口调用成功
{
"code": 0,
"data": {
"device_sn": "W89******",
"cmd_type": "get_nonc",
"info": {
"data": 1,
"err_code": 0,
"rssi": -21,
}
}
}
//接口调用失败
{
"code": 1001,
"msg": "网络超时"
}
返回参数说明
参数名 | 必有 | 类型 | 说明 |
---|---|---|---|
code | 是 | int | 接口参数:错误码 0: 成功 其他: 异常 |
data.info.err_code | 是 | int | 业务参数: 0: 成功 其他: 失败 |
data.info.rssi | 是 | int | 业务参数:设备信号 |
data.info.data | 是 | int | 业务参数: 1: 常闭 0: 常开 |
10.电量查询
简要描述
查询电池电压
请求URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
请求格式
json
参数
{
"app_id":"",
"app_secret":"",
"device_sn": "设备序列号",
"type": 1,
"data": {
"cmd_type": "get_volt",
"data":{}
}
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 用户app_id |
app_secret | 是 | string | 用户app_secret |
device_sn | 是 | string | 设备序列号 |
data.device_cid | 是 | string | 未激活默认数据FFFFFFFFFFFFFFFFFFFF |
data.cmd_type | 是 | string | get_volt 查询电压 |
返回示例
//成功
{
"code": 0,
"data": {
"cmd_type": "get_volt",
"info": {
"data": 7280,
"err_code": 0,
"rssi": -26
}
}
}
//失败
{
"code": 1001,
"msg": "网络超时"
}
返回参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | int | 错误码 0成功其他异常 |
data.info.err_code | int | 0成功其他异常 |
data.info.wifi_rssi | int | 设备信号 |
data.info.data | int | 电池电压,单位:毫伏(mV) |
11.回调数据
简要描述
回调数据非常方便,很多情况下设备主动上报的信息,硬件直接传回业务平台,实现上下线通知,开门通知等自动化需求,需要在获取appid和appsecret处设置回调url,url为已备案域名。
1.开门回调
回调url收到了的数据示例
//成功
{
"device_sn": "W89601EBAXX",//门锁序列号
"type": 2,//1为下发,2为主动回调
"cmd_type": "lock_open",//开门指令
"info": {
"status": 1,//状态1为成功
"err_code": 0,//0表示没有错误发生,指令正常执行
"rssi": -28,//信号值
"notify_cmd": "lock_open",//开门通知指令
"open_type": 2,//1.刷卡开门,2.指纹开门,3.固定密码开门,4.临时密码开门
"open_id": "00000000",//各种权限的id,刷卡时为卡号,指纹开门时为指纹id
"data": 7799//电池电压,毫伏mV
}
}
info.data
: 为wifi锁当前电量,单位mV(毫伏),目前WiFi锁充满电压约为8400毫伏。
2.设备上线回调
回调url收到了的数据示例
//成功
{
"cmd_type": "OnLine",
"type":2,
"device_sn": "W89601EC675",
"info": {
"time": 1680857941
}
}
info.time为上线时间戳,请自行记录以判断设备工作场景网络状态,方便维护。
3.设备离线回调
回调url收到了的数据示例
//成功
{
"cmd_type": "OffLine",
"type":2,
"device_sn": "W89601EC675",
"info": {
"time": 1680857941
}
}
info.time为离线时间戳,请自行记录以判断设备工作场景网络状态,方便维护。
12.删除(与appid解绑)
简要描述
解绑设备,将设备和appid解除绑定关系
请求URL
https://wdev.wmj.com.cn/deviceApi/logout
请求方式
POST
请求格式
json
参数
{
"app_id":"",
"app_secret":"",
"device_sn": ""
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
app_id | 是 | string | 用户app_id |
app_secret | 是 | string | 用户app_secret |
device_sn | 是 | string | 设备序列号 |
返回示例
//成功
{
"code": 0,
"msg": "解绑成功"
}
返回参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | int | 错误码 0成功其他异常 |
data.info.err_code | int | 0成功其他异常 |
data.info.wifi_rssi | int | 设备信号 |
最后编辑:极客师傅 更新时间:2025-04-27 12:41