homeenfeaturesrules

Rules

Rules define what actions are to be performed in response to events related to the
related to the transmission of
new data. Fulfillment of the conditions specified in the rules by the data causes
generation of messages in the service
of the specified type.

Rules can be defined for:

  • a selected device,
  • a selected group of devices,
  • all devices having a specific tag,
  • all devices belonging to a selected location (path) in the organizational structure.

Defining rules

A rule can be active or not.

Incoming data analysis rule is defined for:

  • a device with the selected identifier (EUI),
  • group,
  • devices tagged with a selected name and value.

You can limit the analysis to data no older than a certain number of minutes.

When analyzing changes in values, hysteresis is taken into account.

If the data meets the conditions of the rule, the system generates a notification of the selected level of importance:

  • Info
  • Warning
  • Alert
  • Critical
  • Emergency

The notification is directed to the selected list of users.
Optionally, in case the rule is no longer met (data values return to the expected range), the system generates a notification directed to the specified list of users.

Data analysis conditions are defined by:

  • selecting an option in the form,
  • defining a script that analyzes the data.

Selection of options

If the script tag is not selected on the form, the conditions can be defined by filling in the form fields that appear and specifying:

  • the name of the measurement to be analyzed,
  • the condition for comparison (smaller, larger, equal, different),
  • the value with which to compare.

Several such conditions can be defined.

Python script

By defining conditions using a script, you can check more relationships than by selecting options from a form. For example, compare different measurements with each other.

The script must define a checkRule() function that returns a result by calling conditionsNotMet() or conditionsMet ().

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()

Variables in rule messages

The following variables can be used when creating the content of messages:

  • {target.eui} - EUI of the device to which the reegula applies (if applicable to the device)
  • {target.name} - the name of the device to which the reegulation applies
  • {tag.name} - name of the device tag to which the rule applies
  • {tag.value} - the value of the device tag (named {tag.name}) to which the rule applies
  • {device.eui} - EUI of the device for which the rule took effect
  • {device.name} - the name of the device for which the rule took effect
  • {var} - name of the measurement for which the rule worked
  • {measurement} - the name of the measurement for which the rule worked
  • {value} - the value of the measurement that satisfies the rule
  • {info} - if present, it is used to separate the subject of the message from its content
  • {device.owner} - login of the user who owns the device
  • {device.team} - list of logins of users who are part of the device's team
  • {device.admins} - a list of logins of users who are administrators of the device

Example used in the message:

This is the subject of the notification{info}Note: The value {value} of the {measurement} parameter for device {device.name} ({device.eui}) is above the target
© 2023-2025 Grzegorz Skorupa