How to issue control commands when the device is offline

In the IoT scenario, equipment will be deployed in different locations, and it is difficult to determine the location of equipment before construction, and subsequent services need to be managed based on equipment information. In this scenario, we can use the device dynamic labeling function provided by the IoT platform to realize the program and avoid manual entry errors.

Let's take the management of intelligent vending cabinets as an example to show you the device labeling function.

Distribution of vending machines in West Lake Scenic Area

Technical solutions
After each device is online, the real coordinates are updated by sending data (publish) to the topic of the label update of the IoT platform.

Device label request topic


Device Tag Data Payload

"id": 1570605202,
"version": "1.0",
"params": [
"attrKey": "coordinate",//label (coordinate key is coordinate, other labels can customize the key)
"attrValue": "120.14915:30.230687"//label value
"attrKey": "city",//label
"attrValue": "Hangzhou"//label value
"method": "thing.deviceinfo.update"
The smart vending machine itself has a GPS module, we can get the corresponding latitude and longitude, and through the Amap analysis service, we can get the current city. With the above information, we send Payload data to the specified topic, and put a unique label on our device.


Tag the device through the cloud API

API list

log service
Through the log service, we can troubleshoot the dynamic tagging process of specific devices.
Enter the log service, select the corresponding product, enter the deviceName of the device to be queried, enter deviceinfo in the keyword, and click Search to filter out the message records of updating the device label.

Click messageID, we can see the details of this message, including the reported topic and 2 device tag data.

Extended scene

screening equipment
After the label of the device is updated, we can search for eligible devices according to the label.

Rule engine data flow carries label information
The rule engine data processing SQL also supports obtaining the device label value corresponding to the key through the attribute(key) function. For example, attribute('city') can get the value "Hangzhou".
SQL reference for using attribute functions:

deviceName() as deviceName,
timestamp('yyyy-MM-dd HH:mm:ss') as time,
attribute('city') as city,

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us