In this best practice, temperature sensors are monitored. This article describes how
to create a temperature sensor product and devices in the IoT Platform console. This
topic also describes how to define a Thing Specification Language (TSL) model and
create a data forwarding rule.
Procedure
- Log on to the IoT Platform console.
- In the left-side navigation pane, choose . On the page that appears, click Create Product to create a product. For more information, see Create a product.
- Define a feature.
- On the Product Details page, click the Define Feature tab. Click and then Add Self-defined Feature to define a temperature property for the product.
- After the feature is added, click Release online to publish the TSL model.
- In the left-side navigation pane, choose Devices > Devices. On the page that appears, click Batch Add to add multiple devices.
In this example, you need to add 5,000 devices. You can add a maximum of 1,000 devices
at a time. Therefore, you must add devices a minimum of five times. For more information,
see
Create multiple devices at a time.
- In the left-side navigation pane, choose . On the page that appears, create a data forwarding rule to allow forwarding of the
temperature data reported by the temperature sensor to Function Compute.
- Click Create Rule to create a rule that processes JSON-formatted data.
- Click View to go to the details page of the rule and write an SQL statement to process data.
The SQL statement in this example filters data from the reported property data. The
SQL statement returns the values of the deviceName and Temperature fields when the
temperature is higher than 25°C. The two fields are forwarded to Function Compute.
- Add a data forwarding operation and set the data forwarding destination to Function
Compute.
- After the rule configuration is complete, return to the Data Forwarding page and click Start to enable the rule.