Skip to content

Alarms

Alarm Fields

To create an alarm you must include the following required fields in your post for all alarm types:

  • name: String for the name of your alarm
  • alarm_id: A number that specifies the category of alarm your are creating. See table below.
  • status: Boolean that should be set to 0 or 1 and controls whether the station is active or inactive. if not set status will default to 1 (active).
  • alarm_contacts: An array of JSON objects containing a 'user_id' key and the value of the user to notify when alarm triggers (e.g. [{"user_id": xxx}, {"user_id": xxx}]).

All 'Value Triggered' alarm types must include the following:

  • set_value: A number which is the value that will trigger the alarm
  • clear_value: A number which is the value that once reached will reset the alarm's triggered value.

All 'Rate of Change' alarm types must include the following:

  • roc_minute_span: A number that specifies the time span in minutes for the rate of change alarm.
  • roc_value: A number that specifies the rate of change value

All 'Totalization Triggered' alarm types must include the following:

  • set_value: A number which is the value that will trigger the alarm
  • hour_span: A number that specifies how many hours to totalize over.

Alarm Types

The table below lists all of the available alarm types. You must include the alarm type ID in your post.

Alarm Type Alarm Type ID
Value Triggered Alarm (>=) 1
Value Triggered Alarm (<=) 2
Value Triggered Alarm (>) 3
Value Triggered Alarm (<) 6
Rate of Change Triggered Alarm 7
Totalization Triggered Alarm (>=) 8
Totalization Triggered Alarm (<) 9

POST route:

Replace items encapsulated in ${} (e.g. ${projectId}) with your own ID's. Do not include the ${} brackets in your post.

http://api.stevens-connect.com/project/${projectId}/station/${stationId}/sensor/${sensorId}/channel/${channelId}/channel_alarm

Example for creating a project:

Replace instances of 'xxx' with your own ID's.

curl -H 'Authorization: bearer eyJ0eXAiOiJKV1Q...' -H 'Content-Type: application/json' -X POST -d '{"name":"myAPIAlarm","alarm_id":1,"set_value":5,"clear_value":4,"status":1,"alarm_contacts":[{"user_id":xxx}]}' http://api.stevens-connect.com/project/{projectId}/station/{stationId}/sensor/{sensorId}/channel/{channelId}/channel_alarm

POST response example:

{
  "errors":false,
  "data": {
    "channel_alarm": {
      "is_triggered":0,
      "reading_timestamp":null,
      "name":"myAPIAlarm",
      "alarm_id":"1",
      "set_value":"5",
      "clear_value":"4",
      "status":"1",
      "channel_id": xxx,
      "id": xxx
    },
    "alarm_contacts": [],
    "errors":[]
  }
}

Updating an Alarm

All fields are optional for updates. Replace items encapsulated in ${} (e.g. ${projectId}) with your own ID's. Do not include the ${} brackets in your post.

PATCH route:

http://api.stevens-connect.com/project/${projectId}/station/${stationId}/sensor/${sensorId}/channel/${channelId}/channel_alarm

Example for updating an alarms clear and set values.

curl -H 'Authorization: bearer eyJ0eXAiOiJKV1Q...' -H 'Content-Type: application/json' -X PATCH -d '{set_value":10,"clear_value":9}' http://api.stevens-connect.com/project/${projectId}/station/${stationId}/sensor/${sensorId}/channel/${channelId}/channel_alarm/${alarmId}

Deleting a User

Replace items encapsulated in ${} (e.g. ${projectId}) with your own ID's. Do not include the ${} brackets in your post.

DELETE route:

http://api.stevens-connect.com/project/${projectId}/station/${stationId}/sensor/${sensorId}/channel/${channelId}/channel_alarm/${alarmId}

Example for deleting an alarm where 'xxx' represents the user's ID that you wish to delete:

curl -H 'Authorization: bearer eyJ0eXAiOiJKV1Q...' -X DELETE http://api.stevens-connect.com/project/${projectId}/station/${stationId}/sensor/${sensorId}/channel/${channelId}/channel_alarm/${alarmId}