Sensors / Alarms
Check and control the state of sensors(digital inputs) and alarms(digital outputs).
Authentication
HTTP Basic / Digest authentication is required. The user must have permission to control system devices.
Sensors (Digital Inputs)
All States
To get the state of all sensors, request the following:
GET /api/sensors
This is an example response to the above request.
HTTP/1.1 200 OK
Content-Type: application/json
{
"sensors":[
{
"id":1,
"name": "Sensor 1",
"state":1
},
{
"id":2,
"name": "Sensor 2",
"state":0
},
{
"id":3,
"name": "Sensor 3",
"state":0
},
{
"id":4,
"name": "Sensor 4",
"state":0
},
{
"id":5,
"name": "Sensor 5",
"state":0
},
{
"id":6,
"name": "Sensor 6",
"state":0
},
{
"id":7,
"name": "Sensor 7",
"state":0
},
{
"id":8,
"name": "Sensor 8",
"state":0
}
]
}
Sensor State
To obtain the state of individual sensors, attach the sensor ID to URL as follows.
GET /api/sensors/1
This is an example response to the above request.
HTTP/1.1 200 OK
Content-Type: application/json
{
"id":1,
"name": "Sensor 1",
"state":1
}
Alarms (Digital Outputs)
All States
To get the state of all alarms, request the following:
GET /api/alarms
This is an example response to the above request.
HTTP/1.1 200 OK
Content-Type: application/json
{
"alarms":[
{
"id":1,
"name": "Alarm 1",
"state":0
},
{
"id":2,
"name": "Alarm 2",
"state":0
},
{
"id":3,
"name": "Alarm 3",
"state":0
},
{
"id":4,
"name": "Alarm 4",
"state":0
},
{
"id":5,
"name": "Alarm 5",
"state":1
},
{
"id":6,
"name": "Alarm 6",
"state":1
},
{
"id":7,
"name": "Alarm 7",
"state":1
},
{
"id":8,
"name": "Alarm 8",
"state":1
}
]
}
Alarm State
To obtain the state of individual alarms, attach the alarm ID to URL as follows.
GET /api/alarms/1
This is an example response to the above request.
HTTP/1.1 200 OK
Content-Type: application/json
{
"id":1,
"name": "Alarm 1",
"state":0
}
Alarm Control
To change the state of individual alarms, request JSON data like following:
PUT /api/alarms/1
...
Content-Length: 17
{
"state": 1
}
To change the state of multiple alarms at once, request JSON data like following:
PUT /api/alarms
...
Content-Length: 111
{
"alarms": [
{
"id": 1,
"state": 0
},
{
"id": 3,
"state": 1
}
]
}
The result of the response is the same as the status request.