Alarms via Rule Chain
Manage alarms directly in the Edge rule chain using three dedicated rule nodes: create alarm, clear alarm, and alarm status filter. This approach gives you full programmatic control over alarm creation and clearing, based on any telemetry condition, attribute value, or custom script logic, entirely on the Edge without a server connection.
When to use rule chain alarm nodes
Section titled “When to use rule chain alarm nodes”For most threshold alarms, use alarm rules. They need no rule chain changes, support multiple arguments, dynamic thresholds from attributes, and duration and repeating conditions, and they are evaluated on the Edge. Use the rule nodes instead when the alarm depends on the content of a message in a way the alarm rule arguments cannot express, or when the alarm needs custom details built by a script.
The pattern
Section titled “The pattern”The standard pattern for a threshold alarm in the rule chain:
Post telemetry → [Script filter: condition?] ├─ True → create alarm → Created → (act on new alarm) │ → Updated → (alarm already exists, skip) └─ False → clear alarm → Cleared → (act on cleared alarm) → False → (no alarm was active, skip)Example — temperature threshold alarm
Section titled “Example — temperature threshold alarm”This example creates a Critical alarm when temperature > 35 and clears it when the reading drops to or below 35.
Step 1 — Open the rule chain
Section titled “Step 1 — Open the rule chain”- On the Edge, go to Data processing > Rule chains and open the Edge Root Rule Chain.
Step 2 — Add a Script filter node
Section titled “Step 2 — Add a Script filter node”- In the node panel, search for Script (under Filter) and drag it onto the canvas.
- Set the node name to
High Temp?. - Enter the condition:
return msg.temperature != null && msg.temperature > 35;
- Click Add.
Step 3 — Add a create alarm node
Section titled “Step 3 — Add a create alarm node”- Search for create alarm (under Action) and drag it onto the canvas.
- Configure:
- Alarm type:
High Temperature - Severity: Critical
- Alarm details builder (optional — records the triggering value):
return { temperature: msg.temperature };
- Alarm type:
- Click Add.
- Connect the True output of
High Temp?to this node.
Step 4 — Add a clear alarm node
Section titled “Step 4 — Add a clear alarm node”- Search for clear alarm (under Action) and drag it onto the canvas.
- Set Alarm type to
High Temperature(must match exactly). - Click Add.
- Connect the False output of
High Temp?to this node.
Step 5 — Wire the Script filter to the incoming message
Section titled “Step 5 — Wire the Script filter to the incoming message”- Find the existing Message type switch node in the root rule chain.
- Connect its Post telemetry output to the
High Temp?Script filter node. - Click Apply changes.
Output connections
Section titled “Output connections”create alarm
Section titled “create alarm”| Connection | When | Message after |
|---|---|---|
Created |
A new alarm was created | Message replaced with alarm object; metadata: isNewAlarm: true |
Updated |
Alarm of the same type already existed | Message replaced with alarm object; metadata: isExistingAlarm: true |
Failure |
Script error or invalid severity | Original message unchanged |
clear alarm
Section titled “clear alarm”| Connection | When | Message after |
|---|---|---|
Cleared |
Active alarm was found and cleared | Message replaced with alarm object; metadata: isClearedAlarm: true |
False |
No active alarm existed | Original message unchanged |
Using the alarm status filter
Section titled “Using the alarm status filter”After a create alarm or clear alarm node, the message type changes to ALARM and the payload contains the full alarm object. Use the alarm status filter node to branch on the current alarm status before taking further action (for example, only send a notification on a genuinely new unacknowledged alarm).
Add an alarm status filter node after create alarm, configure the status set (e.g., Active Unacknowledged), and connect:
True→ send notification / RPC / push to cloudFalse→ skip
To apply the same rule chain logic to all Edge instances, configure the rule chain as a rule chain template on the server and assign it to the Edges. An alarm rule created on the server for a device profile does not need a template: it reaches every Edge (4.3.0 and later) automatically.
For step-by-step examples with the alarm rules editor, see Alarm rule tutorials.
For the full alarm management reference, see Manage alarms on Edge.
Was this helpful?