API section
Sensors and meters
The Sensors and meters module: refrigeration controllers, UPS units, energy meters, Zigbee sensors and PLCs over OPC UA (Modbus RTU/TCP, SNMP, Mercury, Zigbee, OPC UA). Latest values and alarms, polling on request, the log for a period and CSV for inspectors, writing setpoints and relays, SNMP traps. Devices are set up on the agent page (Sensors tab); needs the sensors module in the key (except the emulator).
Modbus RTU/TCP, SNMP, Mercury, Zigbee, OPC UA: values, log, alarms
| POST | /api/v1/sensors/{id}/poll | Poll now |
| POST | /api/v1/sensors/{id}/points/{point} | Write a point value |
| GET | /api/v1/sensors | Devices and latest values |
| GET | /api/v1/sensors/{id} | A device and its values |
| GET | /api/v1/sensors/traps | Latest SNMP traps |
| GET | /api/v1/sensors/profiles | Device profiles |
| GET | /api/v1/sensors/journal.csv | Log for Excel and inspectors (CSV) |
| GET | /api/v1/sensors/history | Value log |
Poll now#
/api/v1/sensors/{id}/pollWithout waiting for the interval; the answer is fresh values
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string |
Response 200 application/json
Fields · DeviceView
deviceSensorDevice22 fields · SensorDevice
idstringnamestringprotocolstringprofilestringportstringbaudRateinteger int32paritystringstopBitsinteger int32hoststringtcpPortinteger int32modestringunitinteger int32communitystringsnmpVersionstringpasswordstringintervalSecinteger int32timeoutMsinteger int32alarmDelaySecinteger int32enabledbooleanpointsarray of Point16 fields · Point
idstringnamestringtablestringaddressinteger int32typestringwordOrderstringbitinteger int32scalenumber doubleoffsetnumber doubleunitstringwritablebooleanminnumber doublemaxnumber doubleoidstringparamstringlogboolean
usernamestringnumberinteger int32
profileNamestringstatusstringerrorstringlastOkstringlastPollstringreadingsarray of Reading10 fields · Reading
pointstringnamestringvaluenumber doubletextstringunitstringatstringalarmstringminnumber doublemaxnumber doublewritableboolean
alarmsinteger int32zigbeeZigbeeView4 fields · ZigbeeView
statestringcoordinatorstringpermitJoinLeftinteger int32nodesarray of Node6 fields · Node
ieeestringnwkinteger int32manufacturerstringmodelstringendpointsmap → array of integer int32joinedAtstring
detailstring
Errors — problem+json with a code field, see error codes.
Request example
curl -X POST 'http://localhost:7790/api/v1/sensors/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/poll'curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/sensors/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/poll' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Write a point value#
/api/v1/sensors/{id}/points/{point}Only points with writable: true (a setpoint, a Zigbee relay on/off — 1/0). Without the module — 402 LICENSE_REQUIRED
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | |
pointrequired | path | string |
Request body application/json required
Fields · WriteRequest
valuenumber double
{
"value": 1.5
}Response 200 application/json
Fields · Reading
pointstringnamestringvaluenumber doubletextstringunitstringatstringalarmstringminnumber doublemaxnumber doublewritableboolean
Errors — problem+json with a code field, see error codes.
Request example
curl -X POST 'http://localhost:7790/api/v1/sensors/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/points/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11' \
-H 'Content-Type: application/json' \
--data '{"value":1.5}'curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/sensors/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/points/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42' \
-H 'Content-Type: application/json' \
--data '{"value":1.5}'Devices and latest values#
/api/v1/sensorsEach device: polling status, points with the latest value, alarms (alarm: high/low)
Response 200 application/json
Fields · SensorList
licensedbooleandevicesarray of DeviceView10 fields · DeviceView
deviceSensorDevice22 fields · SensorDevice
idstringnamestringprotocolstringprofilestringportstringbaudRateinteger int32paritystringstopBitsinteger int32hoststringtcpPortinteger int32modestringunitinteger int32communitystringsnmpVersionstringpasswordstringintervalSecinteger int32timeoutMsinteger int32alarmDelaySecinteger int32enabledbooleanpointsarray of Point16 fields · Point
idstringnamestringtablestringaddressinteger int32typestringwordOrderstringbitinteger int32scalenumber doubleoffsetnumber doubleunitstringwritablebooleanminnumber doublemaxnumber doubleoidstringparamstringlogboolean
usernamestringnumberinteger int32
profileNamestringstatusstringerrorstringlastOkstringlastPollstringreadingsarray of Reading10 fields · Reading
pointstringnamestringvaluenumber doubletextstringunitstringatstringalarmstringminnumber doublemaxnumber doublewritableboolean
alarmsinteger int32zigbeeZigbeeView4 fields · ZigbeeView
statestringcoordinatorstringpermitJoinLeftinteger int32nodesarray of Node6 fields · Node
ieeestringnwkinteger int32manufacturerstringmodelstringendpointsmap → array of integer int32joinedAtstring
detailstring
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/sensors'curl 'https://cloud.hw-connector.ru/agent/api/v1/sensors' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'A device and its values#
/api/v1/sensors/{id}Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string |
Response 200 application/json
Fields · DeviceView
deviceSensorDevice22 fields · SensorDevice
idstringnamestringprotocolstringprofilestringportstringbaudRateinteger int32paritystringstopBitsinteger int32hoststringtcpPortinteger int32modestringunitinteger int32communitystringsnmpVersionstringpasswordstringintervalSecinteger int32timeoutMsinteger int32alarmDelaySecinteger int32enabledbooleanpointsarray of Point16 fields · Point
idstringnamestringtablestringaddressinteger int32typestringwordOrderstringbitinteger int32scalenumber doubleoffsetnumber doubleunitstringwritablebooleanminnumber doublemaxnumber doubleoidstringparamstringlogboolean
usernamestringnumberinteger int32
profileNamestringstatusstringerrorstringlastOkstringlastPollstringreadingsarray of Reading10 fields · Reading
pointstringnamestringvaluenumber doubletextstringunitstringatstringalarmstringminnumber doublemaxnumber doublewritableboolean
alarmsinteger int32zigbeeZigbeeView4 fields · ZigbeeView
statestringcoordinatorstringpermitJoinLeftinteger int32nodesarray of Node6 fields · Node
ieeestringnwkinteger int32manufacturerstringmodelstringendpointsmap → array of integer int32joinedAtstring
detailstring
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/sensors/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11'curl 'https://cloud.hw-connector.ru/agent/api/v1/sensors/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Latest SNMP traps#
/api/v1/sensors/trapsUp to 50, newest first; reception is turned on by the trapPort setting
Response 200 application/json
Type: array of map → any value
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/sensors/traps'curl 'https://cloud.hw-connector.ru/agent/api/v1/sensors/traps' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Device profiles#
/api/v1/sensors/profilesBuilt-in register and OID maps and own ones from data/sensors/profiles
Response 200 application/json
Array · SensorProfile
idstringnamestringvendorstringkindstringprotocolstringbaudRateinteger int32paritystringstopBitsinteger int32unitinteger int32notestringpointsarray of Point16 fields · Point
idstringnamestringtablestringaddressinteger int32typestringwordOrderstringbitinteger int32scalenumber doubleoffsetnumber doubleunitstringwritablebooleanminnumber doublemaxnumber doubleoidstringparamstringlogboolean
customboolean
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/sensors/profiles'curl 'https://cloud.hw-connector.ru/agent/api/v1/sensors/profiles' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Log for Excel and inspectors (CSV)#
/api/v1/sensors/journal.csvSeparator “;”, decimal comma; the current month by default
Parameters
| Name | In | Type | Description |
|---|---|---|---|
device | query | string | |
from | query | string date | |
to | query | string date |
Response 200
File.
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/sensors/journal.csv'curl 'https://cloud.hw-connector.ru/agent/api/v1/sensors/journal.csv' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Value log#
/api/v1/sensors/historyPoint values every historySec and every alarm raised and cleared. Dates — yyyy-MM-dd, today by default
Parameters
| Name | In | Type | Description |
|---|---|---|---|
device | query | string | |
point | query | string | |
from | query | string date | |
to | query | string date | |
limit | query | integer int32 |
Response 200 application/json
Array · HistoryRow
atstringdevicestringpointstringvaluenumber doubleunitstringalarmstring
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/sensors/history'curl 'https://cloud.hw-connector.ru/agent/api/v1/sensors/history' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'