Cloud Rules
Overview
If you set a cloud rule, IoTDA determines whether the rule triggering condition is met. If the condition is met, IoTDA performs actions you set, such as alarm reporting, topic notification, and command delivery.
Procedure
- Access the IoTDA service page and click Access Console. Click the target instance card.
- In the navigation pane, choose Rules > Device Linkage. Click Create Rule.
- Create a device linkage rule based on the table below.
Parameter
Description
Best Practice
Rule Name
Specify the name of a rule to create.
Activate upon creation
- Selected: The rule is activated upon creation.
Rule Type
- Cloud: The rule to create is executed on the platform.
- Device side: The rule to create is delivered to devices for execution. Target devices must have the SDK with the device-side rule engine. For details, see Device-side Rules.
Effective Period
- Always effective: There is no time limit. IoTDA always checks whether conditions are met.
- Specific time: You can select a time segment during which the platform checks whether the conditions are met.
Description
Describe the rule.
Set Triggers
You can set whether all conditions or any of the conditions need to meet.
- Device Property: Properties reported by devices can be used as a trigger. For example, the device is powered off when the temperature reaches 80°C.
- Select product: Select a specific product.
- Select the device range:
- All Devices: Set the trigger for all devices under the selected product.
- Specified device: Set the trigger for a specified device under the selected product.
- Select service: Select a service type.
- Select property: Select a property.
NOTE:
- If the data type of a property is int, long, or decimal, you can select multiple operators.
- If the data type of a property is string, date time, or jsonObject, you can only select the equal sign (=) as the operator.
- Triggering Mechanism: Select a trigger strategy. Repetition suppression is recommended.
- Data Validity Period (s): Specify the data validity period. For example, if Data Validity Period is set to 30 minutes, a device generates data at 19:00, and the platform receives the data at 20:00, the action is not triggered even if the conditions are met.
- Timer: Set the time at which the rule is triggered. It is usually used for periodic triggering conditions, such as turning off street lights at 07:00 every day.
NOTE:
If Timer is selected, Send notifications, Report alarms, and Clear alarms cannot be selected for Actions.
- Triggered every day: The rule is triggered at a specified time every day.
- Triggered by policy:
- Select a date and time: start time for triggering the rule.
- Repeat: number of times that the rule can be triggered. The value ranges from 1 to 1440.
- Interval: interval for triggering the rule after the start time. The value ranges from 1 to 1440, in units of minutes.
- Device Status: The online/offline status of a device can be used as a trigger. For example, if a device has been offline for 5 minutes, an alarm will be reported.
- Select product: Select a specific product.
- Select the device range:
- All Devices: Set the trigger for all devices under the selected product.
- Specified device: Set the trigger for a specified device under the selected product.
- Select the device status:
- Online: The device status changes from offline to online.
- Offline: The device status changes from online to offline.
- Online and Offline: The device status changes.
- Duration: duration of the new status after the device status change, in minutes. The value range is 0–60.
Set Actions
Click Add Action to set the action to execute after the rule is triggered.
- Deliver commands: Select the device, service, and command to be delivered in sequence, and set the command delivery parameters.
- Send notifications: Select the region where the SMN service is located. If the platform has not been granted with the permissions to access SMN, perform the authorization as prompted. Click the corresponding link to go to the SMN console and set the topic.
- Message Title: used as the email subject when an email is sent to an email subscriber.
- Message Type: Use a temple or customize the settings.
- Message Content: content of the message to be sent.
- Template: Use the template defined by SMN. When sending messages, the variables in the template is replaced with corresponding parameter values. IoTDA defines some common template variables. After a rule is triggered, the following template variables will be replaced with specific values.
{ruleName}: name of the triggered rule
{ruleId}: ID of the triggered rule
{deviceId}: ID of the device that triggers the rule
{deviceName}: name of the device that triggers the rule
{productId}: ID of the product to which the device that triggers the rule belongs
{productName}: name of the product to which the device that triggers the rule belongs
{YYYY}: year (UTC) when the rule is triggered.
{MM}: month when the rule is triggered (UTC)
{DD}: date when the rule is triggered (UTC)
{HH}: hour (UTC) when the rule is triggered.
{mm}: minute (UTC) when the rule is triggered
{ss}: second (UTC) when the rule is triggered
NOTE:Example SMN template:
Time: {YYYY}-{MM}-{DD} {HH}:{mm}:{ss}
Rule name: {ruleName}
Rule ID: {ruleId}
Product ID: {productId}
Product name: {productName}
Device ID: {deviceId}
Device name: {deviceName}
Event: device going online and offline
After the device goes online and the rule is triggered, the received message is shown in the following figure.
- Report alarms: Define the alarm severity, name, isolation dimension, and content. When the configured condition is met, a device alarm is generated on the Application Operations Management (AOM) console.
- Alarm severity: Options include Info, Minor, Major, and Critical.
- Alarm isolation dimension: Options include User, Resource Space, and Device. Reported alarms carry different isolation dimension identifiers. If you select Device for the dimension, reported alarms will carry device IDs as isolation dimension identifiers.
- Alarm name: name of the reported alarm.
- Alarm content: content carried in the reported alarm.
- Clear alarms: Define the alarm severity, name, isolation dimension, and content. If conditions are met, alarms reported by the device to the platform will be cleared. The parameters are the same as those for reporting alarms.
NOTE:
In AOM, the alarm severity, alarm name, and alarm isolation dimension together identify an alarm. When an alarm is cleared, the three attributes must be the same as those specified during alarm reporting.
- Click Create Rule in the lower right corner. Newly created rules are in the activated state by default. You can disable a rule in the Status column of the rule list.
Figure 1 Creating a linkage rule - BatteryProperty
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot