MQTT推送协议
主题: 系统 pub6/broadcast/v2/sys
设备 pub6/broadcast/v2/dev/xxxx
分组 pub6/broadcast/v2/group/xxxx
推送协议中靠method选择不同的操作类型,和具体动作
接口 | 说明 |
---|---|
method:report,act:status | 设备状态,设备主动上报 |
method:report,act:static_props | 静态属性上报 |
method:sys,act:reboot | 设备控制,重启设备 |
method:sys,act:volume | 设备控制,调节音量 |
##错误码列表 | 错误码 | 说明 | |------ |----- | | 0 | 正确 | | 1 | 错误 | | 2 | 参数错误|
接口详情
<span id = "mqtt_1">设备状态,设备主动上报</span>
from:设备SIP账号/web/sys
to: 设备SIP账号/web/sys
req:请求码
method:操作方法,report
JSON请求示例:
{ "from":"设备sip账号", "to":"sys", "req":"1666596827411", "method":"report", "data":{ "act": "status", "value": 1 //0-离线 1-在线 2-故障 3-故障解除 4-繁忙 }, "seq":1, "ts":1666596827411 }
<span id = "mqtt_2">设备状态,设备主动上报</span>
from:设备SIP账号/web/sys
to: 设备SIP账号/web/sys
req:请求码
method:操作方法,report
JSON请求示例:
{ "from":"设备sip账号", "to":"sys", "req":"1666596827411", "method":"report", "data":"{ "act": "static_props", "value": { "model":"xxxx", //型号 "ip":"127.0.0.1", "mac":"xxxx:xxxx:xxxx", //mac地址 "version":"xxxxx", //版本 "volume":10 //音量,可用值0-31 } }", "seq":1, "ts":1666596827411 }
<span id = "mqtt_3">设备控制:重启设备</span>
from:设备SIP账号/web/sys
to: 设备SIP账号/web/sys
req:请求码
method:操作方法,report
JSON请求示例:
{ "from":"sys", "to":"设备sip账号", "req":"1666596827411", "method":"sys", "data":{ "act": "reboot" }, "seq":1, "ts":1666596827411 }
<span id = "mqtt_4">设备控制:调节音量</span>
from:设备SIP账号/web/sys
to: 设备SIP账号/web/sys
req:请求码
method:操作方法,report
JSON请求示例:
{ "from":"sys", "to":"device", "req":"1666596827411", "method":"sys", "data":{ "act": "volume" "value": 10 //音量 }, "seq":1, "ts":1666596827411 }
<span id = "mqtt_5">音乐播放</span>
from:设备SIP账号/web/sys
to: 设备SIP账号/web/sys
req:请求码
method:操作方法,report
JSON请求示例:
{ "from":" sys ", "to":"设备sip账号", "req":"1666596827411", "method":"file", "data":{ "client": 2, 1-设备,2-调度 "dispatch": "调度sip账号" "act": "play" //play-播放 pause-暂停 continue-继续 stop-停止 add-添加曲目 remove-移除曲目 "repeat": true, //true-循环播放 false-只播一次 "count": 1, //0-无限循环,其他数字-循环次数 "duration": 0 //0-不限制,其他数字播放时长(秒) "list":[ { "id":"xxxxxxx", "src": "http://xxx.xxx.xxx/xxx.mp3", "text": "" } ] }, "seq":1, "ts":1666596827411 }