LogoLogo
Website
  • Overview
  • Getting started
  • Integrations
    • MQTT Integration
    • HTTPS Integration
    • LORIOT Integration
    • Swisscom LPN Integration
    • TheThingsNetwork Integration
    • TheThingsIndustries Integration
    • Sigfox Integration
    • AWS IoT Integration
    • AWS Kinesis Integration
    • Azure Event Hub Integration
    • Azure IoT Hub Integration
    • Helium Network Integration
  • Key concept
    • Entities and relations
    • Entity Groups
    • Attributes
    • Device Profiles
    • Telemetry data
    • Device alarms
    • Version control
  • Dashboards
    • Dashboards
      • Dashboard Templates
      • IAQ Template
      • Aliases
    • Widget library
      • Energy management widgets
        • Summarized annual consumption
        • Daily profile
        • XY chart
  • Rule Engine
    • Rule Engine
      • Rule Engine Templates
        • General data proccessing concept
        • Weather data feed
      • Test Javascript function
      • Predefined Message Types
      • Filter rule nodes
        • check alarm status
        • check existence fields
        • check relation
        • gps geofencing filter
        • message type filter
        • message type switch
        • originator type filter
        • originator type switch
        • script filter
        • switch script node
      • Enrichment rule nodes
        • calculate delta
        • customer attributes
        • customer details
        • originator attributes
        • originator fields
        • originator telemetry
        • related attributes
        • related Device attributes
        • tenant attributes
        • tenant details
      • Transformation rule nodes
        • change originator
        • duplicate to group
        • duplicate to related
        • script transformation
        • to email transformation
        • M-Bus decoder
      • Action rule nodes
        • Add to group
        • Remove from group
        • Generate report
        • Integration Downlink
        • REST Call Reply
        • Change owner
        • Create alarm
        • Clear alarm
        • Delay messages
        • Generator
        • Log
        • RPC Call Reply
        • RPC Call Request
        • GPS geofencing events
        • Save attributes
        • Math Function
        • Asset Profiles Feature
        • fetch device credentials
        • delete attributes
        • split array msg
        • json path
        • delete keys
        • rename keys
        • copy keys
        • Save to Custom
        • Assign To Customer
        • Unassign From Customer
        • Create Relation
        • Delete Relation
        • Push to cloud
        • Pus to edge
        • Save timeseries
      • Analytics rule nodes
        • Aggregate Latest
        • Aggregate Stream
        • Alarms Count
      • Output connectors
        • AWS SNS
        • AWS SQS
        • MQTT
        • RabbitMQ
        • Kafka
        • Azure IoT Hub
        • Rest API
        • Priva
          • Realtime Telemetry API
          • Realtime Setpoint API
          • Data Insight Metadata API
          • Data Insight History API
          • Alarm Data Api
        • SOAP API
        • send email
        • send SMS
        • send Twilio SMS
      • Flow
        • Acknowledge
        • Checkpoint
        • Rule Chain
        • Output
  • Device Type Library
    • telemetry data keys
    • attribute data keys
      • Assets
        • Property
          • Building
          • Floor
          • Room
        • Facility
          • Component
        • City Zone
      • Devices
    • relation Type keys
  • API documentation
    • Admin Controller
  • CLI Tool
    • How to install the tool
    • Dataimport
  • Dynamic QR Codes
    • Dynamic QR Code App
Powered by GitBook
On this page

Was this helpful?

  1. Rule Engine
  2. Rule Engine
  3. Action rule nodes

Clear alarm

PreviousCreate alarmNextDelay messages

Last updated 3 years ago

Was this helpful?

image

This Node loads the latest Alarm with configured Alarm Type for Message Originator and Clear the Alarm if it exist.

Node Configuration:

  • Alarm Details Builder script

  • Alarm Type - any string that represents Alarm Type

The rule node has the ability to get alarm type using pattern with fields from message metadata:

Alarm Details Builder script used for updating Alarm Details JsonNode. It is useful for storing additional parameters inside Alarm. For example you can save attribute name/value pair from Original Message payload or Metadata.

Alarm Details Builder script should return details object.

  • Message payload can be accessed via msg property. For example msg.temperature

  • Message metadata can be accessed via metadata property. For example metadata.customerName

  • Message type can be accessed via msgType property. For example msgType

  • Current Alarm Details can be accessed via metadata.prevAlarmDetails.

Note that metadata.prevAlarmDetails is a raw String field and it needs to be converted into object using this construction:

var details = {};
if (metadata.prevAlarmDetails) {
    details = JSON.parse(metadata.prevAlarmDetails);
}

Example of Details Builder Function

This function takes count property from previous Alarm and increment it. Also put temperature attribute from inbound Message payload into Alarm details.

var details = {temperature: msg.temperature, count: 1};

if (metadata.prevAlarmDetails) {
    var prevDetails = JSON.parse(metadata.prevAlarmDetails);
    if(prevDetails.count) {
        details.count = prevDetails.count + 1;
    }
}

return details;

This Node updates Current Alarm:

  • change alarm status to CLEARED_ACK if it was already acknowledged, otherwise to CLEARED_UNACK

  • set clear time to current system time

  • update Alarm details with new object returned from Alarm Details Builder script

In case when Alarm does not exist or it is already Cleared Alarm, original Message will be passed to the next nodes via False chain.

Otherwise new Message will be passed via Cleared chain.

Outbound message will have the following structure:

  • Message Type - ALARM

  • Originator - the same originator from inbound Message

  • Payload - JSON representation of Alarm that was cleared

  • Metadata - all fields from original Message Metadata. Also additional property inside Metadata will be added -> isClearedAlarm with true value.

Here is an example of Outbound Message payload

{
  "tenantId": {
    "entityType": "TENANT",
    "id": "22cd8888-5dac-11e8-bbab-ad47060c9bbb"
  },
  "type": "High Temperature Alarm",
  "originator": {
    "entityType": "DEVICE",
    "id": "11cd8777-5dac-11e8-bbab-ad55560c9ccc"
  },
  "severity": "CRITICAL",
  "status": "CLEARED_UNACK",
  "startTs": 1526985698000,
  "endTs": 1526985698000,
  "ackTs": 0,
  "clearTs": 1526985712000,
  "details": {
    "temperature": 70,
    "ts": 1526985696000
  },
  "propagate": true,
  "id": "33cd8999-5dac-11e8-bbab-ad47060c9431",
  "createdTime": 1526985698000,
  "name": "High Temperature Alarm"
}

Alarm Details Builder script function can be verified using .

Test JavaScript function