当前位置:网站首页>How to obtain data on mobile phones and web pages after the SCM data is uploaded to Alibaba cloud Internet of things platform?
How to obtain data on mobile phones and web pages after the SCM data is uploaded to Alibaba cloud Internet of things platform?
2022-07-28 18:57:00 【Let's GO Tiger】
Recently I met a need : MCU uploads data to Alibaba cloud Internet of things platform , The mobile terminal or Web terminal can obtain data from the Internet of things platform and display it , Add another mobile terminal / The web side controls the single chip microcomputer through the Internet of things platform .
Finally, the method provided by Alibaba cloud Internet of things platform is adopted , Use the function of rule engine data forwarding , hold Topic 1 Forward your message to Topic 2 in ,
One 、 Create a product and customize a theme

When creating a topic, it is recommended to select publish and subscribe for operation permission , Convenient debugging . In the theme are ${deviceName}, Every device under the representative product can use this type of theme , Just put deviceName Change to equipment name ( Fill in the topic when developing " ${} " Get rid of ), In this way, each device has its own theme , Then use the data flow function , Each device can communicate .
Two 、 Create a device under this product

When creating a device , Device name ( I use web1 To represent web devices ) Please fill in all the suggestions . After creating the device , The device is inactive , At this time, you need to copy the triples of the device , Resolve the domain name of Alibaba cloud Internet of things platform 、 user id、 user name 、 Password and other information , It is used to connect the single chip microcomputer to the Internet of things platform .
3、 ... and 、 Parse triples
There are many tools for parsing triples , Alibaba officials also provide , I am used to using the following tool .
Four 、 The device is connected to the Internet of things platform
I'll use it here MQTT.fx To simulate the connection of the web end to the Internet of things platform , Fill in the relevant information , Click on connect button , If it is a real SCM device , This information is also needed to connect to the Internet of things platform .
After successful connection , Refresh the device , You can see web1 This device is already online 
Check it out web1 Whether the theme subscribed by the device can be used normally .
5、 ... and 、 Rule engine data forwarding function
Follow the steps above , I have created a project named stm32 The equipment , Used to simulate the real MCU to send messages to the Internet of things platform , Then flow the message to web1 In this . Now make sure both devices are online .
Click cloud product flow in the rule engine on the right , Click Create rule , The name of the rule can be arbitrary , But there is a hole in the data format :
- If you choose this json Format , that stm32 The data sent to the Internet of things platform must be json Format , Can be transferred to another theme , otherwise , Another topic is that you can't receive any messages .
- If binary is selected , Then feel free , Any message can be forwarded , Choose... According to your personal needs .

Click Edit rule , On this page , Click "write" in data processing SQL, This is where the data comes from ,SQL Statements can play a certain role in filtering , use * Number means forwarding all data , the reason being that stm32 Give it to me. web1 Send data on the web , So the data source is stm32 The theme under the device ( The customized theme when creating the product , It will assign a theme to each device under the product ).
Then add an operation to the forward data , Choose to publish to another topic , Then fill in the subject of our target device with the following information 
After editing the rule , Remember to return to the startup rule , Here we are !
6、 ... and 、 test
stm32 issue web1:
stm32 Send it to your cell phone :
The above is the process of my test , If there are mistakes in the blog, please point out , Friends who don't understand this process can leave comments !
边栏推荐
- 11 年膨胀 575 倍,微信为何从“小而美”变成了“大而肥”?
- The login interface of modern personal blog system modstartblog v5.4.0 has been revised and the contact information has been added
- What does real HTAP mean to users and developers?
- [actual combat] realize page distortion correction with OpenCV
- Chinese enterprise service industry market in 2022
- EasyNLP中文文图生成模型带你秒变艺术家
- Is the software testing industry really saturated?
- MYSQL入门与进阶(二)
- 2022年牛客多校第2场 J . Link with Arithmetic Progression (三分+枚举)
- GC garbage collector details
猜你喜欢

MYSQL入门与进阶(四)

GC garbage collector details

Introduction and advanced level of MySQL (5)

One Hot编码是什么?为什么要用它,什么时候用它?

真正的 HTAP 对用户和开发者意味着什么?

面试官:ThreadLocal使用场景有哪些?内存泄露问题如何避免?

What does real HTAP mean to users and developers?

112. 使用自开发的代理服务器解决 SAP UI5 FileUploader 上传文件时遇到的跨域访问错误

Introduction and advanced level of MySQL (I)

数字经济时代的开源数据库创新 | 2022开放原子全球开源峰会数据库分论坛圆满召开
随机推荐
AI has changed thousands of industries. How can developers devote themselves to the new "sound" state of AI voice
EasyCVR新版本级联时,下级平台向上传递层级目录显示不全的原因分析
408 review strategy (strengthening stage)
零知识证明:具有DDH假设的 ZKP
Why did wechat change from "small and beautiful" to "big and fat" when it expanded 575 times in 11 years?
N32替换STM32,这些细节别忽略!
[actual combat] realize page distortion correction with OpenCV
11 年膨胀 575 倍,微信为何从“小而美”变成了“大而肥”?
LeetCode_ 343_ integer partition
2022 Hangdian multi school field 2 1011 DOS card (line segment tree)
Log base zap of go language series
历史上的今天:微软收购 QDOS;模型检测先驱出生;第一张激光照排的中文报纸...
Haproxy implements proxy configuration
湖上建仓全解析:如何打造湖仓一体数据平台 | DEEPNOVA技术荟系列公开课第四期
How long does software testing training take?
kotlin:Nothing
A priori, a posteriori, likelihood
Introduction and advanced level of MySQL (6)
LeetCode_ 63_ Different paths II
十进制转二进制进阶版(可转化负数以及边界值)