[关闭]
@soszrg 2019-09-25T14:57:24.000000Z 字数 1840 阅读 744

MQTT Topic规则-带影子功能(V3.1)

V3.1


现有topic(不包含物影子topic)


Topic rule

topic说明:

api/sys消息说明

api消息格式

  1. {
  2. "type": "xxx",
  3. "data": {
  4. "key1": "v1",
  5. "key2": 123,
  6. "key3": "v3",
  7. "req_id": 123...
  8. }
  9. }
字段 类型 说明
type string 消息类型,如ota_check, bind_info等
data json 请求数据
key1 - 具体数据
req_id int 请求唯一id,用于消息追踪

sys消息格式

  1. {
  2. "type": "xxx",
  3. "meta": {
  4. "code": 0,
  5. "message": 提示信息
  6. },
  7. "data": {
  8. "key1": "v1",
  9. "key2": 123,
  10. "key3": "v3",
  11. },
  12. "req_id": 123...
  13. }
字段 类型 说明
type string 消息类型,如ota_check, bind_info等
meta json 响应状态
code int 请求错误码
message string 错误提示信息
data json 响应数据
key1 - 具体数据
req_id int 请求唯一id,用于消息追踪

当前消息类型

superuser

  1. {
  2. "type": "superuser",
  3. "data": {
  4. "password": "password1",
  5. "req_id": 123...
  6. }
  7. }
字段 类型 说明
password string 设备密码

unbind

  1. {
  2. "type":"unbind",
  3. "data":{
  4. "password":"password1",
  5. "req_id":123...
  6. }
  7. }
字段 类型 说明
password string 设备密码

ota_check

  1. {
  2. "type":"ota_check",
  3. "data":{
  4. "password":"password1",
  5. "req_id":123...
  6. }
  7. }
字段 类型 说明
password string 设备密码

ota_log

  1. {
  2. "type":"ota_log",
  3. "data":{
  4. "password":"password1",
  5. "ot_id":97,
  6. "update_ok":true,
  7. "req_id":123...
  8. }
  9. }
字段 类型 说明
password string 设备密码
ot_id int 任务ID
update_ok bool 更新结果:true→成功,false→失败

m2m消息说明

格式

  1. {
  2. "type": "xxx",
  3. "data": {
  4. "key1": "v1",
  5. "key2": 123,
  6. "key3": "v3",
  7. }
  8. }
字段 类型 说明
type string 消息类型,如ota_check, bind_info等
data json 请求数据
key1 - 具体数据

当前消息类型

bind_info

  1. {
  2. "type": "bind_info",
  3. "data": {
  4. "device_id": "dlof..."
  5. }
  6. }
字段 类型 说明
device_id string 设备ID

device_unbind

  1. {
  2. "type": "device_unbind",
  3. "data": {
  4. }
  5. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注