UIFlow-access-Aliyun

Overview

This tutorial will explain how to program in the UIFlow platform for connnecting the device to Aliyun, achieving subscribtion and data publish.

Creat Product

Before accessing, you need to log in Alibaba Cloud Console , started from the console homepage Products and Services->IoT Platform->Public Examples

Click>Device Management->Products->Create Product, configure the product name, type and the networking method. (The networking method in the UIFlow is "WIFI"), click OK to complete the creation.

Creat Device

After completing the product creation, the next thing to do is to add the actual equipment to the product category. Click on the device development option on the product page, and click add/register device

Fill in the device name (this name will be used to configure the connection in the subsequent UIFlow programming) and complete the creation.

After the device is created, you can find the created device in the device list. There are several key information to pay attention to, ProductKey, DeviceSecret, DeviceName, these information will be used in the following programming.

Burn the firmware

Burn UIFlow firmware for your device (firmware version requires v1.8.0 and above), click the corresponding document link below to view the detailed burning steps.

UIFlow burning steps

Programming

Add the Aliyun connection initialization block to the UIFlow workspace, and fill in the ProductKey, DeviceSecret, and DeviceName created in the above steps. Note: region id needs to select the region where the service instance is located, and this information will be displayed in the Alibaba Cloud console.

Subscribe and publish information

UIFlow currently provides three topic subscriptions, user, raw, and shadow update. Different topic subscriptions have different functions and display methods in the Alibaba Cloud console. For example, user can be used for general data interaction, shadow update is mainly used for synchronization of device status, and raw type of topic data allowing users to configure custom scripts on the Alibaba Cloud console to process data. For more details, please check the Alibaba Cloud IoT documentation page , this tutorial only demonstrates basic log viewing , And data uplink and downlink operations.

Add subscription callback functions corresponding to the above three topics in UIFlow, and add display programs for them. Add the topics publish program block in the main loop, and insert the temperature and humidity values ​​into it. Click the run button in the upper right corner of the UIFlow page to execute the program.

Log Viewing

Click Monitor Operation and Maintenance->Log Service, if the device communication is normal, the log will continuously output information. Click and view the data and you will get the temperature, humidity and pressure values at a certain moment.

Publish Information

Enter the device details page, click Topic list->Publish information (user)

Update Device Shadow

Enter the device details page, click Device shadow->Update shadow

RAW data Processing

Enter the product details page to which the device belongs, click Data Analysis, and edit the custom script to process the input, participation, and output parameters.

On This Page