订阅推送的消息格式
消息结构说明
平台推送给第三方平台的消息格式如下所示:
字段 | 说明 |
---|---|
openId | 公司ID |
productId | 产品ID |
nodeEui | 设备ID |
requestId | 请求唯一ID |
command | 命令码 |
timestamp | 推送时间戳 |
encrypted | 是否加密:true-加密 false-不加密 |
payload | 推送的数据内容 |
Command命令码含义说明:
标识 | 状态值 | 类型 |
---|---|---|
UPLINK | 1 | 业务数据 |
CONNECT | 2 | 上线离线 |
HEARTBEAT | 3 | 心跳 |
OTA | 4 | OTA通知 |
DEVICE_LIFECYCLE | 6 | 设备生命周期变更 |
SUBDEVICE_ADD | 7 | 拓扑关系新增 |
SUBDEVICE_DEL | 8 | 拓扑关系删除 |
具体示例
以下举例说明具体发送的数据格式,以供开发参考。
1、上行业务数据消息格式
{
"openId": "3951D54C",
"productId": "A94CE850",
"nodeEui": "356566071258669",
"requestId": "uuid",
"command": 1,
"timestamp": 1606986254823,
"encrypted": false,
"payload": "ecbf0101ad68"
}
2、上下线消息格式
{
"openId": "3951D54C",
"productId": "A94CE850",
"nodeEui": "356566071258669",
"requestId": "uuid",
"command": 2,
"timestamp": 1606986254823,
"encrypted": false,
"payload": "ONLINE"
}
3、心跳数据消息格式
{
"openId": "3951D54C",
"productId": "A94CE850",
"nodeEui": "356566071258669",
"requestId": "uuid",
"command": 3,
"timestamp": 1606986254823,
"encrypted": false,
"payload": "HEARTBEAT"
}
4、OTA通知数据消息格式
{
"openId": "3951D54C",
"productId": "A94CE850",
"nodeEui": "356566071258669",
"requestId": "uuid",
"command": 4,
"timestamp": 1606986254823,
"encrypted": false,
"payload": {
"downId": "4D4D4D7A",
"result": 4,
"softVer": "v1.2"
}
}
5、设备生命周期变更推送消息格式
{ "openId": "3951D54C", "productId": "A94CE850", "nodeEui": "356566071258669", "requestId": "uuid",
"command": 6,
"timestamp": 1606986254823, "encrypted": false,
"payload": "DEVICE_ADD"
}
6、拓扑关系新增推送消息格式
{ "openId": "3951D54C", "productId": "A94CE850", "nodeEui": "356566071258669", "requestId": "uuid",
"command": 7,
"timestamp": 1606986254823, "encrypted": false,
"payload":{ "Subdevices":[{ "openId": "3951D54C", "productId": "A94CE850", "SubdeviceID":"301B970D525A"}, ... ] } }
7、拓扑关系删除推送消息格式
{ "openId": "3951D54C", "productId": "A94CE850", "nodeEui": "356566071258669", "requestId": "uuid",
"command": 8,
"timestamp": 1606986254823, "encrypted": false,
"payload":{ "Subdevices":[{ "openId": "3951D54C", "productId": "A94CE850", "SubdeviceID":"301B970D525A"}, ... ] } }