MQTT
1 总体介绍
Section titled “1 总体介绍”2 topic定义规则
Section titled “2 topic定义规则”<!-- 物模型 -->atu/v2/product/manager/{productId}/upgrad <!-- 固件升级 -->
<!-- 设备管理 -->atu/v2/device/manager/{spaceId}/{deviceId}/registeratu/v2/device/manager/{spaceId}/{deviceId}/activeatu/v2/device/manager/{spaceId}/{deviceId}/rebootatu/v2/device/manager/{spaceId}/{deviceId}/upgrad
<!-- 设备数据上报 -->atu/v2/device/post/{spaceId}/{deviceId}/realdataatu/v2/device/post/{spaceId}/{deviceId}/statusatu/v2/device/post/{spaceId}/{deviceId}/event
<!-- 设备控制 -->atu/v2/device/ctl/{spaceId}/{deviceId}/commandatu/v2/device/ctl/{spaceId}/{deviceId}/response
<!-- 平台通知 -->atu/v2/platform/notice/{spaceId}/{deviceId}/onlineatu/v2/platform/notice/{spaceId}/{deviceId}/offline
...指令下发---mqtt
Section titled “指令下发---mqtt”atu/v2/device/manager/{spaceId}/{deviceId}/active
atu/v2/device/manager/shyl/{mac地址}/active
订阅url : http://biot.airtoall.com:1883 订阅topic: atu/v2/device/manager/+/{mac地址}/active payload:{ type:4, //4 mqtt配置 url:“192.168.50.20”, port:1883, username:"", password:"" } 注mac地址格式: mac_3030F9E22218
- topic含义
第一层, 代表公司atu
第二层, 版本号v2
第三层, 业务范畴, 产品、设备、平台
第四层, 功能范畴,管理、控制、数据上报
第五层, 空间ID
第六层, 设备ID
第七层, 具体功能,注册,注销,下发命令等等
- 变量含义
空间ID:{spaceId}
产品ID:{productId}
设备ID:{deviceId}
3 payload 定义
Section titled “3 payload 定义”3.1 物模型
Section titled “3.1 物模型”物模型更新(刷新缓存用)
Section titled “物模型更新(刷新缓存用)”topic:
airtou/v1/product/{productId}/refresh3.2 设备数据
Section titled “3.2 设备数据”3.2.1 北向-数据上报
Section titled “3.2.1 北向-数据上报”topic:
airtou/v1/{productId}/{deviceId}/up/realdatapayload:
{
"humi": 6574,
"tvoc": 14,
"pm1": 8,
"pm10": 8,
"pm25": 8,
"co2": 512,
"ch2o": 3,
"time": 1689707842249
}topic:
airtou/v1/{productId}/{deviceId}/up/statustopic:
airtou/v1/{productId}/{deviceId}/up/heart事件,如设备报警
Section titled “事件,如设备报警”topic:
airtou/v1/{productId}/{deviceId}/up/eventcommand反馈
Section titled “command反馈”topic:
airtou/v1/{productId}/{deviceId}/up/commandtopic:
airtou/v1/{productId}/{deviceId}/up/test3.2.2 南向-指令下发(激活、控制等)
Section titled “3.2.2 南向-指令下发(激活、控制等)”topic:
airtou/v1/{productId}/{deviceId}/down/reactivepayload:
{
"reactive":true,
{
"name": "temp",
"unit": "℃",
"register_address": "21"
},
{
"name": "humi",
"unit": "%",
"register_address": "22"
},
... ]
}topic:
airtou/v1/{productId}/{deviceId}/down/commandpayload:
{[
{
"deviceName":"hvac-plc",
"attr":"mode",
"value":36
},
{
"deviceName":"hvac-plc",
"attr":"temp",
"value":37
},
{
"deviceName":"hvac-plc",
"attr":"speed",
"value":38
}
] }事件下发,规则引擎
Section titled “事件下发,规则引擎”topic:
airtou/v1/{productId}/{deviceId}/down/eventtopic:
airtou/v1/{productId}/{deviceId}/down/ai设备元信息(物模型)
Section titled “设备元信息(物模型)”topic:
airtou/v1/{productId}/{deviceId}/down/meta设备基本信息
Section titled “设备基本信息”topic:
airtou/v1/{productId}/{deviceId}/down/infotopic:
airtou/v1/{productId}/{deviceId}/down/firmware-upgrad3.2.3 服务端(公共)
Section titled “3.2.3 服务端(公共)”topic:
airtou/v1/{projectId}/{deviceId}/realdatapayload:
{
"humi": 6574,
"tvoc": 14,
"pm1": 8,
"pm10": 8,
"pm25": 8,
"co2": 512,
"ch2o": 3,
"time": 1689707842249
}topic:
airtou/v1/{projectId}/{deviceId}/meta设备基本信息
Section titled “设备基本信息”topic:
airtou/v1/{projectId}/{deviceId}/info
**公共资源----------------------------**topic:
airtou/v1/public/ntp 时钟同步4 常用物模型定义
Section titled “4 常用物模型定义”4.1 多功能传感器(S500)
Section titled “4.1 多功能传感器(S500)”
5 mqtt服务器
Section titled “5 mqtt服务器”url:""
username:"",
password:"",
topic:""