alarm.summary

The alarm.summary command is used to obtain summarized data for alarm states for a thing.

The command summarizes the time spent in each state (in seconds), as well as the percentage of the time period spent in each state.  Only states that have at least one record appear.

Alarm history can be requested by specifying:

  • A definite time period using a start and end date

  • A time period defined by the "last period of time" style query (last 24h, etc.)

TR50 Request

// Definite time period request
{
  "cmd": {
    "command": "alarm.summary",
    "params": {
      "thingKey": "mything",
      "key": "myalarm",
      "start": "2014-01-01T00:00:00Z",
      "end": "2014-01-31T23:59:59Z"
    }
  }
}

// Last period of time request
{
  "cmd": {
    "command": "alarm.summary",
    "params": {
      "thingKey": "mything",
      "key": "myalarm",
      "last": "24h"
    }
  }
}

Request Parameters

Name

Type

Required

Description

 

Thing Identifier Parameters

 

Identifies the Thing associated with the alarm states. If omitted, the thingKey associated with your session will be used. See Thing Identifier Parameters table below for supported parameters.

key

String

Yes

The key of the alarm.

start

String

 

When doing a definite time period request this is the timestamp for the start of the specified time window.

end

String

 

When doing a definite time period request this is the timestamp for the end of the specified time window.

last

String

 

When doing a last period of time request this specifies the last X amount of time in nanoseconds (ns), microseconds (us), milliseconds (ms), seconds (s), minutes (m) or hours (h).

Thing Identifier Parameters

Name

Type

Description

thingKey

String

Key of the thing

thingId

String

Id of the thing

esn

String

Esn of the thing

iccid

String

Iccid of the thing

imei

String

Imei of the thing

imsi

String

Imsi of the thing

meid

String

Meid of the thing

msisdn

String

Msisdn of the thing

TR50 Response

If the command is sent successfully a success message and the alarm state values found are returned. Otherwise, an error and error message will be returned.

The number of records returned is limited by the platform. In cases where your selection has more results than the limit of the platform you should shorten your time window or lower the number of records you are requesting.

{
  "cmd": {
    "success": true,
    "params": {
      "values": [
        {
          "state": 1,
          "duration": 600,
          "percent":  60,
          "count": 6
        },
        {
          "state": 2,
          "duration": 300,
          "percent":  30,
          "count": 3
        },
        {
          "state": 3,
          "duration": 200,
          "percent":  20,
          "count": 2
        }
      ]
    }
  }
}

Response Parameters

The alarm.history response can be either:

  • Values array with the following parameters

Name

Type

Description

state

Integer

The state associated with the alarm state value.

duration

Integer

The duration associated with the alarm state value in seconds.

percent

Integer

The percentage of the specified time window in the state.

count

Integer

The number of alarms triggered during the specified time window.

Duration is calculated as the difference between an alarm state's timestamp and the next state's timestamp. However, unlike alarm.history or alarm.history.multi, the most recent alarm state will have a duration that is calculated as the difference between now and the most recent alarm state's timestamp.