当前位置:网站首页>华为IOT设备消息上报和消息下发验证
华为IOT设备消息上报和消息下发验证
2022-08-11 05:24:00 【Three Big Stones】
1、设备注册
在华为IOT平台设备接入模块,注册一个设备,填写下图所示信息,

可以把设备的密钥复制下来,并保存起来,后续与华为IOT平台通信将会使用到,

2、消息上报主题
系统默认消息上报主题:$oc/devices/{device_id}/sys/messages/up
device_id为设备id,用于设备向平台上报消息
3、消息下发主题
系统默认消息下发主题:$oc/devices/{device_id}/sys/messages/down
device_id为设备id,用于平台向设备发送消息
4、使用MQTT.fx工具连接设备
MQTTX工具地址:https://iotda-document.obs.cn-north-4.myhuaweicloud.com/mqttfx-1.7.1-windows-x64.exe
需要填写clientid,broker地址,端口号,用户名和密码,
1)clientid、用户名和密码来源
使用华为工具生成:Huaweicloud IoTDA Mqtt ClientId Generator

2)broker地址,端口号来源
访问以下url即可查看接入地址信息:https://console.huaweicloud.com/iotdm/?region=cn-north-4#/dm-portal/instance/detail?id=f26413cd-05d8-4721-9114-06c11aedc9ea&type=public

3)打开MQTT.fx工具连接华为IOT平台

订阅一个主题:$oc/devices/62ec8d225f266f255bb99479_ZWG400-COM-003/sys/messages/down
4)消息上报
在MQTT.fx工具发布一个消息,
主题为:$oc/devices/62ec8d225f266f255bb99479_ZWG400-COM-003/sys/messages/up
内容为:hello world!

5)在华为IOT平台查看消息是否收到

可以看到IOT平台能收到设备发送的消息。
6)通过postman给设备下发消息
参考文档:https://apiexplorer.developer.huaweicloud.com/apiexplorer/debug?product=IoTDA&api=CreateMessage
请求头参数:Content-Type:application/json,X-Auth-Token:xxxxxx
关于token的获取可以参考文章华为云IOT平台设备获取api调用笔记_Three Big Stones的博客-CSDN博客
请求体:
{
"message": {
"msg": "hello"
}
}

7)查看MQTT.fx是否收到消息

说明下发消息给设备是成功的。
边栏推荐
猜你喜欢

Toward a Unified Model

Zhejiang University School of Software 2020 Guarantee Research Computer Real Question Practice

【调试记录1】提高MC3172浮点运算能力,IQmath库的获取与导入使用教程

TAMNet:A loss-balanced multi-task model for simultaneous detection and segmentation

关于安全帽识别系统,你需要知道的选择要点

The working principle and industry application of AI intelligent image recognition

Solutions to the 7th Jimei University Programming Contest (Individual Contest)

梅科尔工作室-Pr第二次培训笔记(基本剪辑操作和导出)

Mei cole studios - fifth training DjangoWeb application framework + MySQL database

目标检测——Faster R-CNN 之 Fast R-CNN
随机推荐
自定义形状seekbar学习
Realize data exchange between kernel and userspace through character device virtual file system (passed based on kernel 5.8 test)
第七届集美大学程序设计竞赛(个人赛)题解
Joint 3D Instance Segmentation and Object Detection for Autonomous Driving
梅科尔工作室-HarmonyOS应用开发的第二次培训
Kotlin 增量编译的新方式 | 技术解析
动画(其一)
CMT2380F32模块开发4-UART例程
Maykel Studio - Django Web Application Framework + MySQL Database Second Training
Reconstruction and Synthesis of Lidar Point Clouds of Spray
目标检测前言
OpenPCDet安装最新版:spconv一步到位
梅科尔工作室-深度学习第二讲 BP神经网络
Robust 3D Object Detection in Cold Weather Conditions
LAGRANGIAN FLUID SIMULATION WITH CONTINUOUS CONVOLUTIONS
CMT2380F32模块开发8-Base Timer例程
Robust 3D Object Detection in Cold Weather Conditions
Toolbar 和 DrawerLayout 滑动菜单
基于AI智能图像识别:4个不同的行业应用
Mei cole studios - sixth DjangoWeb application framework + MySQL database training