我们采用 MQTT 协议 作为核心通信方式,为您提供高效稳定的物联网连接服务。
| 配置项 | 参数值 |
|---|---|
| 服务器地址 | con-mqttn.developlink.cloud |
| 端口号 | 1883 |
clientId: 平台设备实例KEY
username: 设备产品KEY
password: md5(clientId+"|"+secureKey)
测试设备
cloentid: d10676fb916989
username: p5cca74b516989
pswd: 46c3de8dca3dd312e132508cff242fa9
MQTT 模式下上行消息不需要 deviceId
Topic:/{productId}/{deviceId}/dp/post
直连网关消息格式:
{
"deviceId": "设备id",
"dp": { "temp": 36.8 } //上报数据
}
层级网关消息格式:
{ "dp": { "1":{ "a": 410 } , "2":{ "b": 23} } }
Topic: /{productId}/{deviceId}/dp/get
直连网关消息格式:
{
"timestamp": 1601196762389, //毫秒时间戳
"messageId": "消息ID",
"deviceId": "设备ID",
"dp": ["sn", "model"] //要读取到属性列表
}
层级网关消息格式:
{
"id": "da62c644017015",
"dp": ["a"],
"subId": "1234",
"timestamp": 1701671428103,
"messageId": "LjIJ6"
}
Topic: /{productId}/{deviceId}/dp/get/reply
消息格式:
● 成功
{
"timestamp": 1601196762389, //毫秒时间戳
"messageId": "与下行消息中的messageId相同",
"dp": { "sn": "test", "model": "test" }, //key与设备模型中定义的属性id一致
"deviceId": "设备ID",
"success": true
}
● 失败
{
"timestamp": 1601196762389, //毫秒时间戳
"messageId": "与下行消息中的messageId相同",
"success": false,
"code": "error_code",
"message": "失败原因"
}
Topic: /{productId}/{deviceId}/dp/set
直连网关消息格式:
{
"timestamp": 1601196762389, //毫秒时间戳
"messageId": "消息ID",
"deviceId": "设备ID",
"dp": { "color": "red" } //要设置的属性
}
层次网关消息格式:
{
"id":"da62c644017015",
"dp":{"a":"12"},
"subId":"1234",
"timestamp":1701671478121,
"messageId":"UMdl3"
}
Topic: /{productId}/{deviceId}/dp/set/reply
消息格式:
{
"timestamp": 1601196762389, //毫秒时间戳
"messageId": "与下行消息中的messageId相同",
"dp": { "color": "red" }, //设置成功后的属性,可不返回
"success": true
}