Use Alibaba Cloud IoT Studio to build a visual interface for the object model

Use Alibaba Cloud IoT Studio to build a visual interface for the object model

The previous article introduced how to use ESP-01S to report data to the physical model: https://blog.csdn.net/weixin_46251230/article/details/128996719

This time, use Alibaba Cloud IoT Studio to build the web page of the object model

Alibaba Cloud IoT Studio: https://studio.iot.aliyun.com/

Note: IoT Studio is free for one month, after one month you have to pay to continue using it

create project

After opening the webpage, click Project Management

insert image description here

Click to create a new project. If there is a project before, you must delete the original one before creating a new one. The trial version can only create one project

insert image description here

Click New Blank Project

insert image description here

Enter project name

insert image description here

Click Product Association on the project home page

insert image description here

Choose to associate your own product, then check to associate all devices under it, and click OK

insert image description here

The previously created product information has been displayed in the product column. If you want to delete the product association later, you can click Disassociate. The device is the same

insert image description here

Click New Web Application

insert image description here

Enter a page name and click OK
insert image description here

edit web page

Create a Temperature Dashboard

Click the component bar in the web page, and you can drag the component to the drawing board to make your own display page

insert image description here

Select a dashboard and click to configure the data source for it on the right

insert image description here

Select your own product, equipment, and the attribute value to be displayed in the equipment, here select the temperature, and finally confirm

insert image description here

Reconfigure units and text

insert image description here

Just set up the temperature dashboard

insert image description here

Click the preview button in the upper right corner to browse the visualization page

insert image description here

ESP-01S sends AT commands to change the temperature value

AT+MQTTPUB=0,"/sys/hiyfcAbCXmq/ESP8266-1/thing/event/property/post","{\"method\":\"thing.event.property.post\"\,\"id\":\"1234\"\,\"params\":{\"temperature\":33}\,\"version\":\"1.0.0\"}",1,0

Because the data source is configured, the data of the temperature dashboard is automatically changed

insert image description here

Create a push button switch

Create a switch and set the data source to a relay of type BOOL

insert image description here

Pay attention when clicking the switch on the preview web page, each time the switch is clicked, the data will be sent to the ESP-01S, and the ESP-01S needs to respond to the data switch to set successfully, otherwise it will rebound

When the button is clicked, the data sent by the cloud platform to ESP-01S

insert image description here

insert image description here

If there is no response, the Web page will display a timeout, and the button will not be opened at the same time

insert image description here

After ESP-01S receives the sent data, it immediately sends an AT command to respond

insert image description here

Then the web page shows that the data is sent successfully, and the button is also opened normally, and the button is closed in the same way, it is necessary to send the AT command to close the relay

insert image description here

Create real-time curves

Configure the data source for the real-time curve, select the single device multi-attribute, and select the temperature value for the property

insert image description here

Add an event in the interaction, when the mouse clicks on the real-time curve, refresh the curve component and display the latest data

insert image description here

Send AT commands to set the temperature value several times to see if the real-time curve shows the temperature change

insert image description here

The real-time curve on the web interface correctly displays the changed temperature value. If you find that the temperature value has not changed, click the curve to refresh, and the time on the abscissa will also be refreshed. The upper left corner displays the last temperature value, which is in line with expectations

insert image description here

Guess you like

Origin blog.csdn.net/weixin_46251230/article/details/128997407
Recommended