MQTT连接参数设置,请参考:南向-mqtt对接协议

MQTT设备数据下发格式(北向平台专用)(平台下发数据到接入端(设备))

数据下发(设备反控)topic拼接规则:$IOTOS/device/update/${网关ID}/${设备ID}/${数据点ID}
拼接事例:$IOTOS/device/update/171/401/1963
设备端如需要接收平台数据下发,需要订阅此topic

{
  "name": "数据点名称",
  "id": 1963,
  "oid": "7be6",
  "ts": 1642502674510.0,
  "value": "QWRYGSGSFDGFDS",
  "requestId": "966cb44c30464305bbea98694664b103",
  "requestTime":1627737953514.123,
}
MQTT设备数据下发,设备端处理结果返回格式(北向平台专用)(接入端(设备)将处理结果上报到平台)

数据下发(设备反控)topic拼接规则:$IOTOS/device/update/${网关ID}/${设备ID}/${数据点ID}/result
拼接事例:$IOTOS/device/update/171/401/1963/result
此topic由平台端订阅,设备端向此发送数据。
responseId由接入设置随机字条,最大字符32.
responseCode、responseDesc字段设置请参考:错误定义附录

{
  "id": 1963,
  "oid": "7be6",
  "name": "数据点名称",
  "value": "QWRYGSGSFDGFDS",
  "ts": 1642502674510.0,
  "requestId": "966cb44c30464305bbea98694664b103",
  "requestTime": 1627737953514.123,
  "responseId": "966cb44c30464305bbea98694664b103",
  "responseTime": 1627737953514.123,
  "responseCode,": 0,
  "responseDesc": "OK"
}
网关上下线事件:

topic拼接规则:$IOTOS/event/gateway/state/${网关ID}

{
    "id": 123456, // 网关ID
    "uuid": "网关UUID", // 网关UUID
    "trigger": "mqtt|rpc(触发渠道)",
    "event": "online|offline",
    "ts": 1627737953514.123
}
设备上下线事件:

topic拼接规则:$IOTOS/event/device/state/${网关ID}/${设备ID}

{
    "id": 123456,
    "oid": "fasdfasfdas",
    "trigger": "mqtt|rpc(触发渠道)",
    "event": "online|offline",
    "ts": 1627737953514.123,
}
数据变化(单个):

topic拼接规则:$IOTOS/event/data/changed/${网关ID}/${设备ID}/${数据点ID}

{
     "name": "数据点名称",
      "id": 1111,
      "oid": "de15",
      "value": "数据点值", 
      "ts": 1627737953514.123, // 发布时间
}
错误码

请参考:错误定义附录

作者:IOTOS  创建时间:2021-11-11 11:42
最后编辑:IOTOS  更新时间:2023-11-29 09:38