Events

Events are specific triggers that will run specified actions. An example event would be an outlet current draw being greater than 5 amps, aith an example action being sending an email to your destination of choice.


Endpoints

GET      /api/events              Gets a list of all events
POST     /api/events              Create new event
POST     /api/events/:event_id    Modify existing event
DELETE   /api/events/:event_id    Remove event

Event Object

{
  "name": "16A Warning Threshold for Banks/Circuit Breaker",
  "id": 2,
  "enabled": true,
  "code": 31,
  "numTicksBeyond": 0,
  "triggered": false,
  "params": [
    "any",
    "16",
    "10"
  ],
  "actions": [
    1,
    2
  ]
}
KeyTypeDescription
namestringName for event
idnumberUnique identifier
enabledbooleanEnable or disable event trigger
codenumberEvent Code. see Event Codes Table
paramsarrayArray of strings for associated to particular event code. See event codes table.
actionsarrayArray of action ID's
triggeredbooleanDescribes whether or not the trigger has met it's threshold
numTicksBeyondnumberNumber of steps beyond the threshold. For example, 3 ticks beyond for max current is 3 seconds beyond
 

List All Events

GET    /api/events     Returns list of events

Example Request

  curl 'http://192.168.1.100/api/events' \
  --header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k'

Expected response is an array of Event Objects

Create New Event

POST /api/events      Create a new Event

Request

Follows Authentication Scheme

{
  "name": "Outlet #2 Amperage Threshold",
  "code": 45,
  "params": [
    "8-286331153",
    "5",
    "3"
  ],
  "actions": [
    2
  ]
}

name required
Name string up to 100 characters

code required
Event code for particular trigger. See Event Code Table.

params required for certain triggers
See Event Code Table. Array of strings, maximum 3 parameters.

actions required
Array of action ID's.

Example Request

curl 'http://192.168.1.100/api/events' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"name":"Outlet #2 Amperage Threshold","code":"45","params":["8-286331153",5,3],"actions":[2]}'

Expected response is an Event Object

Modify Event

POST  /api/events/:event_id    Modifies specific event

Request

Follows Authentication Scheme

{
  "name": "Outlet #2 Amperage Threshold",
  "code": 45,
  "params": [
    "8-286331153",
    "5",
    "3"
  ],
  "actions": [
    2
  ]
}

Same request body as Creating New Events

Example Request

curl 'http://192.168.1.100/api/events/1' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"name":"Outlet #2 Amperage Threshold","code":"45","params":["8-286331153","6","3"],"actions":[2]}'

Expected response is an Event Object

Delete Event Permanently

DELETE  /api/events/:event_id   Permanently remove event

Request

Follows Authentication Scheme

{} // no request parameters

Example Request

curl -X DELETE 'http://192.168.1.100/api/events/1' \
--header 'Cookie: SPID=j2d36cG2ciHKDDqFc3k'

Response

Expected response is a 200 HTTP response for success.

200

 

Event Codes Table

CodeNameParameter 1Parameter 2Parameter 3Description
12AutoPing TimeoutTarget IP Addressfails before action"default", "secondary", or explicit interface name (eth0, eth0.100, br0,ppp0)IP Address to Ping. Failure to ping creates trigger.
13Inlet Line Max Current ThresholdInlet LineAmperage Thresholdsecs past thresholdApplies to 3 phase PDUs with line measurements. Amperage threshold in amps
14Inlet Line Min Current ThresholdInlet LineAmperage Thresholdsecs past thresholdApplies to 3 phase PDUs with line measurements. Amperage threshold in amps
15Inlet Max Current ThresholdInlet IDAmperage Thresholdsecs past thresholdApplies to single phase PDUs. Amperage threshold in amps
16Inlet Min Current ThresholdInlet IDAmperage Thresholdsecs past thresholdApplies to single phase PDUs. Amperage threshold in amps
17Inlet Max Voltage ThresholdInlet IDVoltage Thresholdsecs past thresholdApplies to single phase PDUs. Voltage threshold in volts
18Inlet Min Voltage ThresholdInlet IDVoltage Thresholdsecs past thresholdApplies to single phase PDUs. Voltage threshold in volts
19Inlet Max Line Frequency ThresholdInlet IDLine Frequency Thresholdsecs past thresholdApplies to single phase PDUs. Line frequency threshold in hertz
20Inlet Max Line Frequency ThresholdInlet IDLine Frequency Thresholdsecs past thresholdApplies to single phase PDUs. Line frequency threshold in hertz
21Inlet Min Power FactorInlet IDPower Factor Thresholdsecs past thresholdPower Factor Threshold as a ratio
22Inlet Active Energy Accumulation MaxInlet IDkWh Threshold----
24Inlet Min Active Power ThresholdInlet IDActive Power Thresholdsecs past thresholdActive Power Threshold in watts
23Inlet Max Active Power ThresholdInlet IDActive Power Thresholdsecs past thresholdActive Power Threshold in watts
25Inlet Max Apparent Power ThresholdInlet IDApparent Power Thresholdsecs past thresholdApparent Power Threshold in volt-amperes (VA)
26Inlet Min Apparent Power ThresholdInlet IDApparent Power Thresholdsecs past thresholdApparent Power Threshold in volt-amperes (VA)
29Inlet 3 Phase ImbalanceInlet ID% Imbalance Thresholdsecs past threshold--
30Bank Circuit Breaker TripBank ID------
31Bank Max Current ThresholdBank IDAmperage Thresholdsecs past thresholdAmperage threshold in amps
32Bank Min Current ThresholdBank IDAmperage Thresholdsecs past thresholdAmperage threshold in amps
33Bank Max Voltage ThresholdBank IDVoltage Thresholdsecs past thresholdVoltage threshold in volts
34Bank Min Voltage ThresholdBank IDVoltage Thresholdsecs past thresholdVoltage threshold in volts
35Bank Max Line Frequency ThresholdBank IDLine Frequency Thresholdsecs past thresholdLine Frequency threshold in hertz
36Bank Min Line Frequency ThresholdBank IDLine Frequency Thresholdsecs past thresholdLine Frequency threshold in hertz
37Bank Min Power FactorBank IDPower Factor Thresholdsecs past threshold
38Bank Active Energy Accumulation MaxBank IDkWh Threshold--
39Bank Max Active Power ThresholdBank IDActive Power Thresholdsecs past thresholdActive Power Threshold in watts
40Bank Min Active Power ThresholdBank IDActive Power Thresholdsecs past thresholdActive Power Threshold in watts
41Bank Max Apparent Power ThresholdBank IDApparent Power Thresholdsecs past thresholdApparent Power Threshold in volt-amperes (VA)
42Bank Min Apparent Power ThresholdBank IDApparent Power Thresholdsecs past thresholdApparent Power Threshold in volt-amperes (VA)
45Outlet Max Current ThresholdOutlet IDAmperage Thresholdsecs past thresholdApplies to PDUs with Outlet Current Measurements. Amperage threshold in amps
46Outlet Min Current ThresholdOutlet IDAmperage Thresholdsecs past thresholdApplies to PDUs with Outlet Current Measurements. Amperage threshold in amps
49Temperature Max ThresholdSensor IDTemperature Thresholdsecs past thresholdRequires attached temperature/humidity sensor. Temperature threshold in celsius
50Temperature Min ThresholdSensor IDTemperature Thresholdsecs past thresholdRequires attached temperature/humidity sensor. Temperature threshold in celsius
51Humidity Max ThresholdSensor IDHumidity Thresholdsecs past thresholdRequires attached temperature/humidity sensor. Humidity threshold as relative humidity %
52Humidity Min ThresholdSensor IDHumidity Thresholdsecs past thresholdRequires attached temperature/humidity sensor. Humidity threshold as relative humidity %
53Scheduled Daily TimeTime to trigger----Time of day in military time. example: 13:01
54Scheduled Time Interval------Triggers every X seconds forever
55ATS Switched to Secondary------Applies to ATS PDUs. Triggers when Primary ATS Inlet has lost power and switches to Secondary
56ATS Switched to Primary------Applies to ATS PDUs. Triggers when Primary ATS Inlet has recovered and switches from Secondary to Primary
57Secondary Power Source Lost------Applies to ATS PDUs. Triggers when Secondary ATS Inlet has lost power.
58Secondary Power Source Restored------Applies to ATS PDUs. Triggers when Secondary ATS Inlet has recovered power.
59System Power Recovery EventBank ID----Fires when the given Bank has booted up after having no power. Will fire with circuit breaker trip for supported devices. For single inlet devices, choose any bank. For Dual circuit devices, Banks are linked with inlets.
60Monthly Scheduled EventDay of MonthHour Of DayMinute of HourDay of month as a number between 1 and 28, hour of day as 0-23, minute as 0-59
61Weekly Scheduled EventDay of WeekHour of DayMinute of hourDay of week as 0-6, hour of day as 0-23, minute at 0-59
62Digital Input State HighSensor Port (A or B)Digital Input Index (1-6)secs past thresholdRequires SPA-0140 Smart IO Hub. Triggers an event when a hub's digital input senses high for # secs past threshold
63Digital Input State LowSensor Port (A or B)Digital Input Index (1-6)secs past thresholdRequires SPA-0140 Smart IO Hub. Triggers an event when a hub's digital input senses low for # secs past threshold
64User Switch TriggeredSensor Port (A or B)State triggered to--Requires SPA-0140 Smart IO Hub. If state is triggered OFF, then when user switch is turned off, event is triggered
65Sensor Connected/DisconnectedSensor Port (A or B)Connect/Disconnect--