Skip to content

Alarm Management

ThinkLink provides a built-in alarm system that allows devices and assets to raise, track, and clear alarm events. Alarms are triggered by the Trigger Model through the ALARM RPC, and can optionally send email notifications to configured groups.

1.1. Overview

The alarm workflow consists of three parts:

  1. Trigger Model — runs after each uplink, evaluates conditions, and calls the alarm RPC with action: "new" or action: "clear".
  2. ALARM RPC — the built-in ALARM function processes the call and creates or clears the alarm record in the platform.
  3. Alarm Management UI — the operations team views active alarms, inspects history, and manually clears alarms when needed.

1.2. Alarm Levels

LevelDescription
lowInformational. No immediate action required.
midWarning. Should be investigated.
highError. Requires prompt attention.
urgentCritical. Immediate action required.

1.3. Configuring Alarms

Step 1 — Mount the ALARM RPC

ThinkLink includes a built-in general-purpose alarm RPC named ALARM. Mount it on the target device or asset:

Path: Maintenance → Device Management → [select device] → Details → RPC → Add

Select ALARM from the list. The ALARM RPC accepts the following parameters (all passed from the trigger model):

ParameterDescription
nameUnique alarm event name.
action"new" to raise, "clear" to resolve.
titleAlarm title displayed in the UI.
descAlarm description.
levelSeverity: "low", "mid", "high", or "urgent".
notifyArray of notification group names [...]. Dispatched per group when the alarm is raised or cleared.

Step 2 — Configure a Trigger Model

Write a trigger script that evaluates device telemetry and returns an actions array calling the alarm method. Mount the trigger model on the same device.

See Trigger Model for the full script reference and examples.

Step 3 — (Optional) Configure Email Notification Groups

To receive email alerts, configure a notification group in:

Path: System Management → Notification Groups

Store the group names on the device (e.g. device.server_attrs.notify) as a plain array, read it inside your trigger script, and pass it as the notify parameter to the alarm RPC.

1.4. Alarm Event Lifecycle

Uplink data arrives


  Trigger script runs

  condition met? ──No──▶ return null (no action)
        │ Yes

  action = "new"
  ALARM RPC called

  alarm already identical? ──Yes──▶ suppressed (no duplicate)
        │ No

  Alarm record created
  Email sent (if group configured)


  condition clears
  action = "clear"
  ALARM RPC called


  Alarm record resolved

1.5. Viewing Alarms

Path: Alarm → Alarm List

The alarm list displays all active and historical alarm events with the following fields:

FieldDescription
Alarm NameThe unique alarm_name of the event.
DeviceThe device or asset that raised the alarm.
TitleThe alarm title.
LevelSeverity level with color coding.
DescriptionDetailed description of the alarm.
Created AtTimestamp when the alarm was first raised.
StatusActive or Resolved.

1.6. Clearing Alarms

1.6.1. Automatic Clear via Trigger Script

The recommended approach is to handle both raising and clearing in the same trigger script. Set action to "clear" by default, and only switch to "new" when the condition is met. Each uplink then automatically clears the alarm once the condition is no longer satisfied — no manual action required.

javascript
let action = ACTION.clear;   // default: clear

if (tdata.temperature >= 80) {
    action = ACTION.new;     // condition met: raise alarm
}

1.6.2. Checking Whether an Alarm Is Active

Inside an RPC script (not the trigger script), use the alarms input parameter to inspect the current active alarms for the device:

javascript
function rpc_script({ device, params, alarms, logger }) {
    let alarmInfo = alarms["high_temp_alarm"];

    if (alarmInfo !== undefined) {
        // The alarm is currently active
        // alarmInfo.title, alarmInfo.level, alarmInfo.desc are available
    } else {
        // No active alarm with this name
    }
}

alarms is a key–value map, keyed by alarm_name. A key present in the map means the alarm is active; a key absent (or undefined) means no alarm is raised.

The ALARM RPC also uses alarms internally for deduplication: if an identical alarm (same name, title, desc, and level) is already active, a repeated "new" action is suppressed automatically.

1.6.3. Manually Clearing an Alarm

If the trigger condition has been resolved but the platform alarm was not automatically cleared (e.g. the clear action was not configured), an operator can manually clear the alarm:

  1. Navigate to Alarm → Alarm List.
  2. Locate the target alarm entry.
  3. Click Clear in the operation column.
  4. The alarm status changes to Resolved and is removed from the active alarm view.

1.7. Complete Configuration Example

The following shows a full end-to-end alarm setup for a fill-level sensor.

Device server_attrs (set via RPC or platform UI):

json
{
    "alarm_depth": 20,
    "notify": ["ops-team"]
}

Trigger Model script:

javascript
function trigger_script(device, thingModelId) {
    const ACTION = { no: "no", new: "new", clear: "clear" };

    let tdata  = device?.telemetry_data?.[thingModelId];
    if (tdata?.depth === undefined) { return null; }

    let name   = "low_level_alarm";
    let title  = "Low Level: [" + device.name + "]";
    let level  = "high";
    let desc   = "";
    let action = ACTION.clear;
    let notify = device?.server_attrs?.notify ?? [];

    if (tdata.depth <= device.server_attrs?.alarm_depth) {
        desc   = "[" + device.name + "] fill level is critically low";
        action = ACTION.new;
    }

    return {
        delayms: 0,
        abort_previous_timer: true,
        actions: [{
            method: "alarm",
            params: {
                _eui:   device.eui,
                action: action,
                name:   name,
                title:  title,
                level:  level,
                desc:   desc,
                notify: notify
            }
        }]
    };
}

ALARM RPC (built-in, no modification needed) is mounted on the device with method name alarm.

✅ Once configured, the alarm will be raised automatically every time depth drops below the threshold, and cleared when it recovers. Each unique name represents an independent alarm event — multiple alarm types can coexist on the same device.