Clear Alarm
Use this node to clear an active alarm when the triggering condition resolves — for example, when temperature drops back below the threshold that created a “High Temperature” alarm. The node finds the active alarm by type and originator (or directly by alarm ID), clears it, updates its details field via a script, and emits the cleared alarm object downstream.
Configuration
Section titled “Configuration”-
Alarm type — required. The type of alarm to clear (e.g.,
High Temperature). Supports templatization — use${metadata.key}and${data.key}to build dynamic values. -
Alarm details script — a TBEL or JavaScript function that generates the content for the alarm’s
detailsfield when clearing. The function must return a valid JSON value (primitive, array, or object) and has access to:msg— message datametadata— message metadatamsgType— message typemetadata.prevAlarmDetails— the previous alarm details as a JSON string
Message processing algorithm
Section titled “Message processing algorithm”-
Resolve alarm type: expand the configured alarm type pattern using the message data and metadata.
-
Find the alarm to clear:
- If the message originator is an
ALARMentity: fetch that alarm directly by ID (the configured alarm type is ignored). - Otherwise: query the database for the latest active alarm with the resolved alarm type and the same originator as the message.
- If the message originator is an
-
Clear the alarm:
- If an active (non-cleared) alarm exists:
- Set
cleared = trueandclearTsto the current system time. - Execute the details builder script (with
metadata.prevAlarmDetailscontaining the previous details JSON). - Update the alarm’s
detailsfield with the script result. - Set metadata
isClearedAlarm: true. - Replace the message data with the cleared alarm object and change the message type to
ALARM. - Route via
Cleared. - Emit an
ALARM_CLEARlifecycle event to the originator’s root rule chain.
- Set
- If no active alarm exists, or the alarm is already cleared:
- Forward the original message unchanged via
False. No database changes occur.
- Forward the original message unchanged via
- If an active (non-cleared) alarm exists:
Output connections
Section titled “Output connections”| Connection | Condition |
|---|---|
Cleared | An active alarm was found and successfully cleared. Message data is replaced with the cleared alarm object; metadata includes isClearedAlarm: true; message type is ALARM. |
False | No active alarm exists for the specified type and originator, or the alarm was already cleared. |
Examples
Section titled “Examples”Example 1 — Clearing an active alarm
Section titled “Example 1 — Clearing an active alarm”Incoming message
Data: { "temperature": 25.0 } | Originator: DEVICE
Node configuration
{ "scriptLang": "TBEL", "alarmDetailsBuildTbel": "return { clearedAt: msg.temperature };", "alarmType": "High Temperature"}State: an active High Temperature alarm exists for the originator with status ACTIVE_UNACK.
Outgoing message
Data:
{ "id": { "entityType": "ALARM", "id": "f66e9b38-6f0e-4dc7-ad57-1cb4e014b6fc" }, "type": "High Temperature", "originator": { "entityType": "DEVICE", "id": "3bc2eb60-8d77-11f0-8a6c-59050cd4204f" }, "severity": "CRITICAL", "acknowledged": false, "cleared": true, "startTs": 1757429087063, "endTs": 1757429195123, "clearTs": 1757429287456, "status": "CLEARED_UNACK", "details": { "clearedAt": 25.0 }}Metadata: { "isClearedAlarm": "true" } | Message type: ALARM | Connection: Cleared
The alarm status changes from ACTIVE_UNACK to CLEARED_UNACK, the details script runs with access to metadata.prevAlarmDetails, and an ALARM_CLEAR lifecycle event is sent to the device’s root rule chain.
Example 2 — No active alarm to clear
Section titled “Example 2 — No active alarm to clear”State: no active High Temperature alarm exists for the originator.
Result: original message forwarded unchanged via False. No alarm modifications; no lifecycle events.
Example 3 — Clearing by alarm ID directly
Section titled “Example 3 — Clearing by alarm ID directly”Originator: ALARM with ID f66e9b38-6f0e-4dc7-ad57-1cb4e014b6fc
When the message originator is an ALARM entity, the node fetches and clears that specific alarm by ID — the configured alarm type is ignored. The alarm status changes from ACTIVE_ACK to CLEARED_ACK.
JSON schema
Section titled “JSON schema”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "TbClearAlarmNodeConfiguration", "type": "object", "properties": { "alarmType": { "type": "string", "description": "Alarm type (supports templatization)." }, "scriptLang": { "type": "string", "enum": ["TBEL", "JS"], "description": "Script language for the details builder function." }, "alarmDetailsBuildJs": { "type": "string", "description": "JavaScript details builder function body." }, "alarmDetailsBuildTbel": { "type": "string", "description": "TBEL details builder function body." } }}