thing.alarm.states

The thing.alarm.states command is used to obtain the number of things in each state of an alarm.

 The command will summarize the number of things in each state of an alarm, if the thing doesn't have the alarm, then it will be counted under the state "-1".  Only the states that have at least one thing in it will be returned.

TR50 Request


                        {
  "cmd": {
    "command": "thing.alarm.states",
    "params": {
      "key": "myalarm"
    }
  }
}
      

Request Parameters

Name

Type

Required

Description

key

String

Yes

The key of the alarm.

tags

Array

 

An array of tags that the alarm's things must match.

thingIds

Array

 

An array of thing ids used to constrain the results.

thingKeys

Array

 

An array of thing keys used to constrain the results.

TR50 Response

If the command is sent successfully a success message and the number of things per state found are returned. Otherwise, an error and error message will be returned.


                        {
  "cmd": {
    "success": true,
    "params": {
      "values": [
        {
          "state": 1,
          "count": 6
        },
        {
          "state": 2,
          "count": 3
        },
        {
          "state": -1,
          "count": 2
        }
      ]
    }
  }
}
      

Response Parameters

The thing.alarm.states.response can be either:

  • Values array with the following parameters

Name

Type

Description

state

Integer

The state associated with the alarm state value, a state of -1 indicates the things that don't have the specified alarm state.

count

Integer

The number of things in the state.