pdf-icon

UIFlow - Integration - Tencent Cloud

Overview

This tutorial will demonstrate how to connect programming devices to the Tencent Cloud platform through UIFlow programming, using the construction of a temperature and humidity collection node as a case study.

Create a Project

Before starting the integration, register and log in to the Tencent Cloud - IoT Development Platform , click Public Instance -> Create Project -> Fill in Project Name/Description -> Save

Start by creating a project on the Tencent Cloud IoT Development Platform. Fill in the project name and description to create a new project on Tencent Cloud.

Create a Product

A product can be understood as a collection of a certain type of devices. Users manage all devices under the product. Click on the project created in the previous step -> Enter the Product Development Center -> Create a Product -> Define Your Product -> Fill in the Basic Product Information -> Save.

Fill in the basic product information to create a new product in the Tencent Cloud IoT platform.

Set the basic product information as shown in the picture, where the name can be customized, but other settings are recommended to remain consistent.

Data Template

Data templates digitally describe physical entity devices, constructing their digital models. Defining a data template on the IoT development platform means defining the product's functionality. After completing the functionality definition, the system will automatically generate the data template for the product. Since we chose a custom product, it does not have standard functions, and we need to define the functions ourselves. Click on the product created -> Create Function.

Define temperature and humidity functions for your product on Tencent Cloud IoT platform.

As shown below, define the temperature and humidity functions separately. In actual applications, you can add more function definitions according to your own needs.

Define more functions based on your requirements for the Tencent Cloud IoT product.

Continue adding and defining functions for your IoT product on Tencent Cloud.

Finalize function definitions for your product on the Tencent Cloud IoT platform.

Create a Device

After defining the functions, click Device Debugging above -> Click to Create a New Device -> Fill in the Device Name -> Save. Click on the device that has been successfully created to view the details page. (This will include the keys and device-related information needed for UIFlow connection)

Create a new device under your product on Tencent Cloud IoT platform.

View device details including keys and information for UIFlow connection on Tencent Cloud.

Burn Firmware

Burn UIFlow firmware to your device (firmware version 1.7.3 and above required). Click the document link below to view detailed burning steps.

UIFlow firmware burning steps

Write the Program

    product id: Product ID, can be viewed on the device information interface
    device name: Device name, as above
    device secret: Device secret, as above
    keepalive: Heartbeat time 0 ~ 120 (seconds)

Drag and drop code blocks in UIFlow to connect and push data to Tencent Cloud.

  • Micropython API
from IoTcloud.Tencent import Tencent

# Initialize connection
tencent = Tencent(
    product_id='XXXXXXXXXXX', 


- Micropython API

```python

from IoTcloud.Tencent import Tencent

//Initialize connection
tencent = Tencent(
    product_id='XXXXXXXXXXX', 
    device_name='XXXXXXX', 
    username='XXXXXXXXXXXXXXXXXX;12010126;B335D;1702277766',
    password='e822dc0027a1b363f9ed1a23fb77860c0b707d7d;hmacsha1',
    port=1883,
    keepalive=30
)

//upload data
tencent.publish_property_msg(temperature=temp,humidity=humid)


//Downlink data callback


def tencent_fun(property_data):
  print(property_data)

//The subscription platform sends messages


tencent.subscribe_property_msg(tencent_fun)

Background view data

The code block below is used to push data to the cloud platform, and the data is sent as a 'key-value', where the 'key' value needs to be consistent with the 'identifier' in the custom function. When the device is running, you can view the uplink data of the device in the device logs.

Small program view data

Tencent cloud service and the small program 'Tencent Lianlian' integration docking, users can be very convenient through the small program to view the reported data of the device. 'Device list' -> 'Device QR code'. (Open wechat mini program 'Tencent Lianlian' and click '+' to scan the code and bind the device).

On This Page