Alarm Rules
Alarm rules define when alarms are created, updated, and cleared. Each rule specifies the data sources to monitor, the conditions that trigger or clear an alarm, the severity level, and how the alarm propagates through the entity hierarchy.
Rules can be defined at the level of a device, asset, their profiles, or a Customer. For an overview of alarm concepts, states, and severity levels, see Alarms.
How alarm rules work
Section titled “How alarm rules work”When a message arrives (telemetry update, attribute change, or inactivity event), ThingsBoard evaluates every alarm rule whose arguments match the incoming data:
Creating an alarm rule
Section titled “Creating an alarm rule”The Alarm rules page allows you to centrally manage all alarm rules in the system — both for individual entities and for profiles.
- Open the Alarms page from the left-hand menu.
- Go to the Alarm rules tab.
- Click the + button in the top-right corner.
- Select Create new alarm rule from the dropdown menu.
General
Section titled “General”The General section sets the basic identity of the alarm rule:
- Alarm type: The name and unique identifier of the alarm, like High Temperature. ThingsBoard uses the alarm type to decide whether to create a new alarm or update an existing active one.
- Entity type: The target entity or entity profile where the rule applies.
Debug mode
Section titled “Debug mode”Enabling debug mode lets you track events, states, and errors during rule execution.
Arguments
Section titled “Arguments”Before defining alarm conditions, add at least one argument — a data source the rule evaluates.
Click Add argument and configure:
Entity type determines where the argument value comes from:
| Value | Description |
|---|---|
| Current entity | The entity being configured. For profile-level rules, it applies to all entities using that profile. |
| Device or Asset | Retrieves telemetry or attributes from a different Device or Asset. |
| Customer | Retrieves data from the associated Customer entity. |
| Current tenant | Retrieves data from the Tenant entity. |
| Current owner | Retrieves data from the owner of the current entity. |
Argument type determines what kind of data the argument represents:
| Type | Required fields |
|---|---|
| Attribute | Attribute scope (Server / Client / Shared), Attribute key, optional Default value |
| Latest telemetry | Time series key, optional Default value |
Argument name is the identifier used in conditions and formulas, like temperature or maxThreshold.
After filling in all fields, click Add.
Trigger conditions
Section titled “Trigger conditions”Trigger conditions define when an alarm is created and at what severity. Click Add trigger condition.
Severity
Section titled “Severity”Select the severity level for this trigger condition. For level descriptions, see Alarm severity.
When an existing alarm is active and a new trigger fires at a higher severity, ThingsBoard upgrades the severity of the existing alarm rather than creating a new one.
Condition
Section titled “Condition”The condition is the logical expression that determines whether an alarm is created or updated.
Click Add condition, then click Add argument filter and configure:
- Argument: The variable to compare, like
temperature. - Value type: The data type: Numeric, Boolean, String, etc.
- Filters: One or more comparisons. For each filter, set:
- Operation:
equal,not equal,greater than,less than,missing for, and others. - Value source: Static for a fixed value, or Dynamic to use the value of another argument.
- Value: The value to compare against.
- Operation:
When multiple filters are present, combine them with AND (all must be true) or OR (at least one must be true).
Conditions can be written manually or using TBEL script functions for advanced expressions.
Condition types
Section titled “Condition types”| Type | Behavior |
|---|---|
| Simple | Triggers immediately when the expression becomes true. |
| Duration | The condition must remain true continuously for a defined period, reducing false positives from short data spikes. |
| Repeating | Triggers only after the condition occurs a specified number of times in a row. |
Schedule
Section titled “Schedule”The schedule defines when a trigger condition is allowed to fire. If the condition becomes true outside the allowed window, no alarm is created.
Static schedule offers three modes:
| Mode | Description |
|---|---|
| Active all time | The rule is always active. |
| Active at a specific time range | Active on selected days within a time range, like Mon–Fri, 09:00–18:00. |
| Custom schedule | Supports different intervals for each day of the week. |
Dynamic schedule lets you provide a schedule JSON object through an attribute or telemetry instead of a static configuration. This is useful when the schedule varies between devices or customers. To use dynamic mode, go to Schedule, choose Dynamic mode, and select the argument that contains the schedule JSON.
Schedule JSON examples:
Active all time:
{ "type": "ANY_TIME" }Active on Tuesday and Thursday, full day, Europe/Kiev timezone:
{ "type": "SPECIFIC_TIME", "daysOfWeek": [2, 4], "startsOn": 0, "endsOn": 0, "timezone": "Europe/Kiev"}Custom schedule, every day, full 24 hours:
{ "type": "CUSTOM", "timezone": "Europe/Kiev", "items": [ { "dayOfWeek": 1, "enabled": true, "startsOn": 0, "endsOn": 0 }, { "dayOfWeek": 2, "enabled": true, "startsOn": 0, "endsOn": 0 }, { "dayOfWeek": 3, "enabled": true, "startsOn": 0, "endsOn": 0 }, { "dayOfWeek": 4, "enabled": true, "startsOn": 0, "endsOn": 0 }, { "dayOfWeek": 5, "enabled": true, "startsOn": 0, "endsOn": 0 }, { "dayOfWeek": 6, "enabled": true, "startsOn": 0, "endsOn": 0 }, { "dayOfWeek": 7, "enabled": true, "startsOn": 0, "endsOn": 0 } ]}Field reference:
timezone: Time zone for interpreting the schedule.daysOfWeek: Days in numeric format (1 = Monday, 7 = Sunday).startsOn/endsOn: Milliseconds from the start of the day. Setting both to0means the full day.
Clear condition
Section titled “Clear condition”The clear condition defines when ThingsBoard automatically transitions an alarm to Cleared state.
Without a clear condition, the alarm never clears automatically and can only be cleared manually via the UI or API.
Click Add clear condition and configure:
- Condition: The expression that determines when the alarm is resolved, like
temperature ≤ 30. Uses the same filter and argument configuration as trigger conditions. - Condition type: Simple, Duration, or Repeating. See Condition types for behavior details.
- Schedule: When the clear condition is allowed to fire. The alarm is not cleared if the condition is met outside the allowed window.
- Additional info: Extra data stored in Alarm Details at the moment of clearing. Supports
${attributeName}placeholders. - Mobile dashboard: The dashboard that opens when viewing a cleared alarm in the mobile app.
Advanced settings
Section titled “Advanced settings”Additional info
Section titled “Additional info”The Additional info field stores extra contextual data alongside the alarm, visible in the alarm details view. It supports dynamic placeholders using ${attributeName}.
Use it for data like operator notes, troubleshooting steps, documentation links, or a zone ID.
Mobile dashboard
Section titled “Mobile dashboard”The Mobile dashboard field specifies which dashboard opens in the ThingsBoard mobile app when a user navigates to the alarm, giving field engineers immediate access to relevant widgets and diagnostics on-site.
Propagation
Section titled “Propagation”Propagation controls at which level of the entity hierarchy the alarm becomes visible. For a conceptual overview, see Alarm propagation.
Propagate to related entities: The alarm becomes visible to all entities related to the originator, regardless of relation type. In a Device → Office → Building chain, all three entities see the alarm.
Propagate to the owner (Customer / Tenant): Makes the alarm visible to the direct owner of the originator without requiring explicit relations.
**Propagate to entity owners hierarchy:** Propagates the alarm up the entire ownership chain: Asset → Customer → Tenant. All higher-level owners see the alarm even without a direct relation to the originator. This applies to B2B platforms with nested customer structures and MSP deployments.Propagate to Tenant: Makes the alarm visible at the Tenant level regardless of ownership or relations. Use this when the Tenant Administrator needs visibility into all alarms across the infrastructure.
Managing alarm rules
Section titled “Managing alarm rules”Alarm rules appear in the table on the Alarms → Alarm rules page. The table shows alarm type, target entity, severity levels, and whether a clear condition is configured.
Each rule row has an action bar:
| Action | Description |
|---|---|
| Copy | Copies the rule configuration for quick creation of a new rule. |
| Export | Exports the rule as a JSON file for backup or migration. |
| Events | Opens the event log for triggers, clears, state changes, and errors. |
| Debug | Enables debug mode and shows detailed execution information. |
| Edit | Opens the rule editor. |
| Delete | Removes the alarm rule. |
Click a rule row to view its full details. To edit a rule, click Edit (pencil) in the details panel, make your changes, then click Apply (checkmark) to save.
Export / import
Section titled “Export / import”To export a rule, go to Alarms → Alarm rules and click Export (download icon) in the rule’s row.
To import a rule:
- Go to Alarms → Alarm rules.
- Click + and select Import alarm rule.
- Drop the JSON file into the import dialog or select it manually.
- Click Import.
- Specify the entity or profile the rule applies to.
- Click Add.
The rule becomes active immediately after saving.
Examples
Section titled “Examples”The following tutorials walk through common alarm rule configurations, from basic thresholds to dynamic schedules. Each example builds on the previous one using a Thermometer device.
| Example | What you learn | Tutorial |
|---|---|---|
| Temperature threshold | Basic trigger: alarm when temperature > 10 | Example 1 |
| Clear condition | Auto-clear alarm when temperature ≤ 4 | Example 2 |
| Duration condition | Trigger only when threshold is exceeded continuously for 1 minute | Example 3 |
| Dynamic duration | Drive the duration threshold from a device attribute | Example 4 |
| Repeating condition | Trigger after the condition occurs 3 times in a row | Example 5 |
| Schedule | Restrict alarm triggering to weekdays 10:00–19:00 | Example 6 |
| Enable/disable flag | Use a boolean attribute to toggle the alarm per device | Example 7 |
For full step-by-step instructions, see Alarm rule tutorials.