Skip to content

Cookie preferences

We use cookies for our own analytics and to see how our campaigns perform. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details.

Security, load balancing and remembering your cookie choice.

Show us which pages people read and how they find the site, so we can improve it (Google Analytics).

Show us which of our ad campaigns bring visitors to the site (Google Ads).

© 2026 The ThingsBoard Authors
Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

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 node without a cloud connection.

Use rule chain alarm nodes when you need logic that device profile alarm rules cannot express: conditions that span multiple telemetry keys, dynamic thresholds from attributes, or post-alarm actions (such as sending an RPC to another device). For single-key threshold alarms, device profile alarm rules require less configuration.

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)

This example creates a Critical alarm when temperature > 35 and clears it when the reading drops to or below 35.

  1. On the Edge instance, go to Rule chains and open the Edge Root Rule Chain.
  2. Click Edit.
  1. In the node panel, search for Script (under Filter) and drag it onto the canvas.
  2. Set the node name to High Temp?.
  3. Enter the condition:
    return msg.temperature !== undefined && msg.temperature > 35;
  4. Click Add.
  1. Search for create alarm (under Action) and drag it onto the canvas.
  2. Configure:
    • Alarm type: High Temperature
    • Severity: Critical
    • Alarm details script (optional — records the triggering value):
      return { temperature: msg.temperature };
  3. Click Add.
  4. Connect the True output of High Temp? to this node.
  1. Search for clear alarm (under Action) and drag it onto the canvas.
  2. Set Alarm type to High Temperature (must match exactly).
  3. Click Add.
  4. 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”
  1. Find the existing Message type switch node in the root rule chain.
  2. Connect its Post telemetry output to the High Temp? Script filter node.
  3. Click Apply changes.
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
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

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 cloud
  • False → skip

For step-by-step examples using the standalone alarm rules editor in ThingsBoard 4.3 and later, see Alarm rule tutorials.

For the full alarm management reference, see Manage alarms on Edge.