Rules define what actions should be performed in response to events related
to the transmission of new data
by devices. When data fulfills the conditions specified in the rules, the service
generates a message
of a specific type.
Rules can be defined for:
A rule can be active or inactive.
An incoming data analysis rule is defined for:
Analysis can be limited to data not older than a specified number of minutes.
Hysteresis is taken into account when analyzing value changes.
When the data meets the rule's conditions, the system generates a notification with a selected severity level:
The notification is directed to a selected list of users.
Optionally, when the rule ceases to be met (data values return to the expected range), the system generates a notification sent to the specified list of users.
Data analysis conditions are defined by:
If the script checkbox is not checked on the form, conditions can be defined by filling in the appearing form fields and specifying:
Multiple such conditions can be defined.
By defining conditions using a script, you can check more dependencies than by selecting options from the form. For example, compare different measurements with each other.
The script must define a checkRule() function returning the result by calling the conditionsNotMet() or conditionsMet() function.
Example:
def checkRule():
v1 = getValue("temperature1")
v2 = getValue("temperature2")
if v1 is None or v2 is None:
return conditionsNotMet()
if v2 - v1 > 10:
return conditionsMet("temperature2",v2)
return conditionsNotMet()
When composing message content, the following variables can be used:
{target.eui} - EUI of the device to which the rule applies (if it applies to a device){target.name} - name of the device to which the rule applies{tag.name} - name of the device tag to which the rule applies{tag.value} - value of the device tag (named {tag.name}) to which the rule applies{device.eui} - EUI of the device for which the rule was triggered{device.name} - name of the device for which the rule was triggered{var} - name of the measurement for which the rule was triggered{measurement} - name of the measurement for which the rule was triggered{value} - measurement value that fulfills the rule{info} - if present, it is used to separate the message subject from its body{device.owner} - username of the user who owns the device{device.team} - list of usernames of users belonging to the device's team{device.admins} - list of usernames of users who are administrators of the deviceExample of use in a message:
This is the notification subject{info}Warning! The value {value} of parameter {measurement} for device
{device.name} ({device.eui}) is above target.