当前位置:网站首页>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 !
边栏推荐
- MYSQL入门与进阶(十)
- Why app uses JSON protocol to interact with server: serialization related knowledge
- [GXYCTF2019]StrongestMind
- 广告推荐CTR点击率预测实践项目!
- Is zero basic software testing training reliable?
- Mongodb initialization
- Introduction and advanced MySQL (4)
- 零知识证明:具有DDH假设的 ZKP
- EasyCVR接入设备后播放视频出现卡顿现象的原因分析及解决
- When the new version of easycvr is linked at the same level, the subordinate platform passes up the cause analysis of the incomplete display of the hierarchical directory
猜你喜欢

湖上建仓全解析:如何打造湖仓一体数据平台 | DEEPNOVA技术荟系列公开课第四期

How to adjust the brightness of win11? Four methods of adjusting screen brightness in win11

jvm四种引用类型

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

LeetCode_ 96_ Different binary search trees

What if you don't understand the difference between modularity, componentization and plug-in?

Introduction and advanced MySQL (7)

Three minutes to understand, come to new media

The switching language of unity causes an error: system FormatException:String was not recognized as a valid DateTime.

EasyNLP中文文图生成模型带你秒变艺术家
随机推荐
Introduction and advanced level of MySQL (9)
Is the software testing training institution reliable?
1.3 linked list
AI has changed thousands of industries. How can developers devote themselves to the new "sound" state of AI voice
“讳疾忌医”的开源走不远
Win11系统svchost.exe一直在下载怎么办?
N32替换STM32,这些细节别忽略!
Swiftui component how to implement textfield of hidden part of phone number mask (tutorial includes source code)
What does real HTAP mean to users and developers?
MySQL date function
Is two months of software testing training reliable?
Pyqt5 rapid development and practice 5.3 multithreading
MYSQL入门与进阶(九)
4 年后,Debian 终夺回“debian.community”域名!
2022 Niuke multi School Game 2 J. link with arithmetic progress (three points + enumeration)
1.1. Sparse array
Introduction and advanced MySQL (7)
jvm四种引用类型
redis持久化之RDB和AOF的区别
先验、后验、似然