物模型通信协议

<p>IOT设备与平安云IOT物联网平台基于MQTT通信协议进行数据传输,物模型管理功能是指使用属性/服务/事件对产品支持的能力进行描述:</p> <p>1. 属性:上报温度</p> <p>2. 服务:下发设备开关机指令</p> <p>3. 事件:上报故障码</p> <p><strong>属性:</strong></p> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="background-color:#ededed; vertical-align:top"> <p><strong>功能</strong></p> </td> <td style="background-color:#ededed; vertical-align:top"> <p>上报属性</p> </td> </tr> <tr> <td style="vertical-align:top"> <p><strong>MQTT</strong></p> <p><strong>客户端</strong></p> </td> <td style="vertical-align:top"> <p>topic:{productKey}/{DeviceName}/sys/thing/event/property/post</p> <p>requestParam:</p> <p>{</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;id&quot;: &quot;xxxx&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----消息id,设备端唯一</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;version&quot;: &quot;1.0&quot;,&nbsp;&nbsp; ----协议版本号</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;params&quot;: {</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;temperature&quot;: 33&nbsp;&nbsp;&nbsp; ----温度标识符及温度值</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;method&quot;: &quot;thing.event.property.post&quot;</p> <p>}</p> </td> </tr> </tbody> </table> <p><strong>服务:</strong></p> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="background-color:#ededed; vertical-align:top"> <p><strong>功能</strong></p> </td> <td style="background-color:#ededed; vertical-align:top"> <p>调用服务</p> </td> </tr> <tr> <td style="vertical-align:top"> <p><strong>MQTT</strong></p> <p><strong>服务器</strong></p> </td> <td style="vertical-align:top"> <p>topic:{productKey}/{DeviceName}/sys/thing/service/PowerSwitch</p> <p>requestParam:</p> <p>{</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;id&quot;: &quot;xxxx&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----消息id,设备端唯一</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;version&quot;: &quot;1.0&quot;,&nbsp;&nbsp; ----协议版本号</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;params&quot;: {</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;switch&quot;: xxx&nbsp;&nbsp;&nbsp;&nbsp; ----0-关机,1-开机</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;method&quot;: &quot;thing.service.PowerSwitch &quot;&nbsp;&nbsp; ----请求方法</p> <p>}</p> </td> </tr> </tbody> </table> <p><strong>事件:</strong></p> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="background-color:#ededed; vertical-align:top"> <p><strong>功能</strong></p> </td> <td style="background-color:#ededed; vertical-align:top"> <p>事件上报</p> </td> </tr> <tr> <td style="vertical-align:top"> <p><strong>MQTT</strong></p> <p><strong>客户端</strong></p> </td> <td style="vertical-align:top"> <p>topic:{productKey}/{DeviceName}/sys/thing/event/Error/post</p> <p>requestParam:</p> <p>{</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;id&quot;: &quot;xxxx&quot;,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;----消息id,设备端唯一</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;version&quot;: &quot;1.0&quot;,&nbsp;&nbsp; ----协议版本号</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;params&quot;: {</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;ErrorCode&quot;: xxx&nbsp;&nbsp;&nbsp;&nbsp; ----int32,取值范围0~200</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;method&quot;: &quot;thing.event.Error.post &quot;&nbsp;&nbsp; ----请求方法</p> <p>}</p> </td> </tr> </tbody> </table>
以上内容是否解决了您的问题?
请补全提交信息!
咨询·建议

电话咨询 - 7x24 小时

400-151-8800

邮件咨询

cloud@pingan.com

在线客服

7x24 小时,急速解答

工单支持

解决云产品相关技术问题