Automatic Device Shutdown Upon High Temperature
Scenarios
The IoT platform supports device data reporting and command delivery. To associate the two, an application needs to provide corresponding logic.
However, with the rule engine function provided by IoT Device Access, the platform can automatically deliver specified commands when specific data is reported, reducing the application development workload.
In this example, when the temperature reported by the temperature sensor of a device is higher than 80°C, the IoT platform automatically delivers a command to shut down the device.
Configuring IoT Device Access
Using IoT Device Access, you can create a product model, register a device, and set a device linkage rule to enable the IoT platform to send a command when receiving specific data from the device.
- Log in to the IoTDA console.
- On the navigation pane, click Products. Click the drop-down list box above the product list, and select the resource space to which the new product belongs.
Note: The product model and device used in this document are only examples. You can use your own product model and device.
- Click Create Product in the upper right corner to create a product using MQTT. Set the parameters and click Create.
Set Basic Info
Product Name
Enter a value, for example, MQTT_Device.
Protocol
Select MQTT.
Data Type
Select JSON.
Manufacturer
Customize the value.
Define Product Model
Product Model
For details about how to import a model, see 5.
Industry
Set the parameters as required.
Device Type
- Click Profile.zip to download a sample product model.
- On the Model Definition tab page, click Import Local Profile. In the dialog box displayed, upload the product model and click OK.

- In the navigation pane, choose . On the page displayed, click Individual Register in the upper right corner. On the page displayed, set device registration parameters and click OK.

Parameter
Description
Product
Select the product created in 3.
Node ID
Specify a unique physical identifier for the device, such as its IMEI or MAC address. This parameter is used by the platform to authenticate the device during device access.
- For a native MQTT device, set the node ID to a string consisting of letters and numbers. The device ID (corresponding to the node ID) and secret generated after the registration are used for device access.
-
For an NB-IoT device (device using LwM2M over CoAP) or a device integrated with the SDK, set the node ID to the IMEI or MAC address. The device connects to the platform using the node ID and secret entered during registration.
Indicates the device name.
Customize the value.
Authentication Type
Select Secret.
Secret
Customize the secret used for device access. If the secret is left blank, the platform automatically generates a secret.
Click OK. Save the device ID and secret returned after the registration is successful.
- In the navigation pane, choose , and click Create Rule in the upper right corner.
- Set the parameters based on the table below. The following parameter values are only examples. You can create your own rules by referring to User Guide. After setting the parameters, click Create Rule.

Parameter
Description
Rule Name
Specify the name of the rule to be created, for example, Overheated.
Activate Now
Select Activate Now.
When Effective
Select Always effective.
Item
Provide a description of the rule, for example, "The device is automatically shut down when the device temperature is higher than 80°C."
Set Trigger Conditions
- Click Add Condition.
- Select Triggered upon specified device.
- Select the device added in 6.
- Select tempSensor for Service Type, temperature for Property, > for Operation, and 80 for Value. Click Trigger Mode. In the dialog box displayed, set Trigger Suppression to Yes and Data Validity Period (s) to 300, click OK.
Set Actions
- Click Add Action.
- Select Deliver Commands, and select the device created in 6.
- Select deviceSwitch for Service Type, and ON_OFF for Command. Click Configure Parameter. In the dialog box displayed, set power to off, click OK.
Verifying the Configurations
- You can use a registered physical device to access the platform and enable the device to report the temperature greater than 80.
- You can also use a simulator to simulate a device to subscribe to Topic: $oc/devices/{device_id}/sys/properties/report (replace {deviceId} with the actual device ID) and report data whose temperature is greater than 80. For details, see Connecting MQTT Devices.
Expected result:
- If you use a physical device to report data, the device receives an ON_OFF command in which power is OFF.
- If you use a simulator to report data, you can view the ON_OFF command in which power is OFF on the Subscribe tab page.
Last Article: Triggering Alarms and Sending Email or SMS Notifications
Next Article: Automatically Opening the Window upon High Gas Concentration
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.