SENTRON PAC – REST API
Question:
Is it possible to access PAC devices via a web-based REST API?
Problem presentation and suggested solutions:
For PAC2200, PAC3200T, PAC3220 and PAC42x0 the platform features a webserver, presenting
important measuring data. All variants which have an ethernet interface can be accessed by any browser
on the network. The web server uses asynchronous JavaScript and XML (AJAX) for transferring
measurement data separated from the HTML code of the web page. The data is transferred in standard
JSON objects.
This document describes the data objects sent by the web server via the resource “/data.json”.
Contents
1. Requests and datapoints........................................................................................................... 2
1.1. DATA.JSON ........................................................................................................................ 2
1.2. Instantaneous measurements ................................................................................................ 3
1.3. Overview data ...................................................................................................................... 4
1.4. Product Information (IM0 Data) .......................................................................................... 4
1.5. Device Location Info (IM1-4 Data) ..................................................................................... 5
1.6. Energy counters ................................................................................................................... 5
1.7. Energieprotokolle (Active energy logs) ............................................................................... 6
1.8. Average values (Aggregation log) ....................................................................................... 7
1.9. Extreme values ..................................................................................................................... 7
1.10. Waveform data ................................................................................................................. 8
2. Example applications ............................................................................................................. 10
2.1. Analyze active energy logs with web browser .................................................................. 10
2.2. Analyze active energy logs with Excel .............................................................................. 12
07.02.2023 1 / 14
SENTRON PAC – REST API
1. Requests and datapoints
1.1. DATA.JSON
All web available data points are accessible via http within file “/data.json”. This file is dynamically created
by the device at request time. All response objects include the device time. Depending on the URI
parameters, the device responds with JSON data objects. Depending on the device type, some requests
may not be available. Unavailable resources will be answered with empty objects.
The resource is requested with standard http GET query:
GET /data.json?type=parameter HTTP/1.1 ...
Available parameters are described below
07.02.2023 2 / 14
SENTRON PAC – REST API
1.2. Instantaneous measurements
Request: http://device-url/data.json?type=INST
Response object:
{"INST_VALUES": {
"LOCAL_TIME": "2022-08-17T11:22:25+02:00",
"V_L1": {“value": 237.899,"unit": "V"},
"V_L2": {"value": 237.955,"unit": "V"},
...
}}
Available metering data:
PAC3220 (FW V3.2.3 and newer) PAC3200T PAC2200
V_L1, V_L2, V_L3, V_L1, V_L2, V_L3, V_L1, V_L2, V_L3,
V_L12, V_L23, V_L31, V_L12, V_L23, V_L31, V_L12, V_L23, V_L31,
I_L1, I_L2, I_L3, I_L1, I_L2, I_L3, I_L1, I_L2, I_L3,
VA_L1, VA_L2, VA_L3, VA_L1, VA_L2, VA_L3, VA_L1, VA_L2, VA_L3,
P_L1, P_L2, P_L3, P_L1, P_L2, P_L3, P_L1, P_L2, P_L3,
VARQ1_L1, VARQ1_L2, VARQ1_L3, VARQ1_L1, VARQ1_L2, VARQ1_L3, VARQ1_L1, VARQ1_L2, VARQ1_L3,
PF_L1, PF_L2, PF_L3, PF_L1, PF_L2, PF_L3, PF_L1, PF_L2, PF_L3,
THDV_L1, THDV_L2, THDV_L3, THDV_L1, THDV_L2, THDV_L3,
THDV_L12, THDV_L23, THDV_L31, THDV_L12, THDV_L23, THDV_L31,
THDI_L1, THDI_L2, THDI_L3, THDI_L1, THDI_L2, THDI_L3,
COS1_L1, COS1_L2, COS1_L3, COS1_SUM COS1_L1, COS1_L2, COS1_L3, COS1_SUM
FREQ, FREQ, FREQ,
V_LN_AVG, V_LN_AVG, V_LN_AVG,
V_LL_AVG, V_LL_AVG, V_LL_AVG,
I_AVG, I_AVG, I_AVG,
VA_SUM, VA_SUM, VA_SUM,
P_SUM, P_SUM, P_SUM,
VARQ1_SUM, VARQ1_SUM, VARQ1_SUM,
PF_SUM, PF_SUM, PF_SUM,
V_BAL, V_BAL,
I_BAL,
I_N_MEAS1,I_5_MEAS1,I_6_MEAS1,*
I_N_MEAS2,I_5_MEAS2,I_6_MEAS2,*
I_N_SEL **
* If 7KM9200-0AD00 plugged in slot x
** I_N_SEL, displayed In, depending on setting either IN calculated or IN measured by module.
07.02.2023 3 / 14
SENTRON PAC – REST API
1.3. Overview data
This object contains important overview data. This is used on the overview web page of the devices.
Request: http://device-url/data.json?type=OVERVIEW
Response object:
{"OVERVIEW": {
"LOCAL_TIME": "2022-08-17T11:38:02+02:00",
"AKZ": "Building 1",
"OKZ": "Office",
"ACTUAL_TARIFF":"T1",
"Import_T1": {"value": 22495.51,"unit": "kWh"},
"Import_T2": {"value": 000.00,"unit": "kWh"},
"Export_T1": {"value": 53.15,"unit": "kWh"},
"Export_T2": {"value": 0.00,"unit": "kWh"},
"TODAY_T1": {"value": 40.76,"unit": "kWh"},
"TODAY_T2": {"value": 0.00,"unit": "kWh"},
"THISMONTH_T1": {"value": 140.76,"unit": "kWh"},
"THISMONTH_T2": {"value": 0.00,"unit": "kWh"},
"DEVICE_STATE":4196352,
"P_L1": {"value": 1.16,"unit": "kW"},
"P_L2": {"value": 1.17,"unit": "kW"},
"P_L3": {"value": 1.17,"unit": "kW"},
"P_SUM": {"value": 3.50,"unit": "kW"},
"VA_SUM": {"value": 6.25,"unit": "kVA"},
"VARQ1_SUM": {"value": 5.19,"unit": "kvar"},
"PF_SUM": {"value": 0.559,"unit": " "}
}}
1.4. Product Information (IM0 Data)
Request: http://device-url/data.json?type=PRODUCT_INFO
Response object:
{"PRODUCT_INFO": {
"name": "PAC3220 V3.2.3",
"orderId": "7KM3220-0BA01-1DA0",
"DT": "1618188142",
"ES": "1",
"serial": "ABC/123456789000",
"FW": "V3.2.3.0-1.1.0.3"
}}
07.02.2023 4 / 14
SENTRON PAC – REST API
1.5. Device Location Info (IM1-4 Data)
Request: http://device-url/data.json?type=DEVICE_INFO
Response object:
{"DEVICE_INFO": {
"AKZ": "171.5 M13.0",
"OKZ": "Camelot, Round Table",
"INSTALLATION_DATE": "13.01.2022",
"DESCRIPTOR": "Just a flesh wound",
"SIGNATURE": "Tim the Enchanter"
}}
1.6. Energy counters
Request: http://device-url/data.json?type=COUNTER
Response object:
{"COUNTER":{
"LOCAL_TIME":"2022-08-17T11:44:50+02:00",
"ACTUAL_TARIFF":"T1",
"ACTIVE_ENERGY":{
"unit":"kWh",
"IMPORT":{"T1":{"total":96.80,"L1":32.28,"L2":32.27,"L3":32.26},
"T2":{"total":0.00,"L1":0.00,"L2":0.00,"L3":0.00},
"TOTAL":{"secondary":9.76,"primary":96.80}
},
"EXPORT":{"T1":{"total":0.00,"L1":0.00,"L2":0.00,"L3":0.00},
"T2":{"total":0.00,"L1":0.00,"L2":0.00,"L3":0.00},
"TOTAL":{"secondary":0.00,"primary":0.00}
}
},
"REACTIVE_ENERGY":{
"unit":"kvarh",
"IMPORT":{"T1":{"total":0.00,"L1":0.00,"L2":0.00,"L3":0.00},
"T2":{"total":0.00,"L1":0.00,"L2":0.00,"L3":0.00},
"TOTAL":{"secondary":0.03,"primary":0.00}
},
"EXPORT":{"T1":{"total":47.16,"L1":15.67,"L2":15.74,"L3":15.74},
"T2":{"total":0.00,"L1":0.00,"L2":0.00,"L3":0.00},
"TOTAL":{"secondary":4.72,"primary":47.16}
}
},
"APPARENT_ENERGY":{
"unit":"kVAh",
"NET":{"T1":{"total":200.77,"L1":66.91,"L2":66.94,"L3":66.93},
"T2":{"total":0.00,"L1":0.00,"L2":0.00,"L3":0.00},
"TOTAL":{"secondary":20.18,"primary":200.77}
}
}
}}
07.02.2023 5 / 14
SENTRON PAC – REST API
1.7. Energieprotokolle (Active energy logs)
Requests: http://device-url/data.json?type=DAILYPROFILE&start=a&count=b
http://device-url/data.json?type=MONTHLYPROFILE&start=a&count=b
http://device-url/data.json?type=YEARLYPROFILE&start=a&count=b
Parameter: COUNT: (Optional). If given, the number of entries to read. If -1: request all entries. If not
given, COUNT defaults to 100.
START: (Optional). First OID to read (direction to read always into the past). When
START is not given, response will deliver the COUNT newest entries.
Profile Entry Object (example):
{
"OID":10, Object ID (not resettable)
"TS":"2022-08-15T00:00:00+01:00", Timestamp of period end
"import":2.42410, total imported energy portion
"export":-0.00000, total exported energy portion
"FLAGS":4280352769, flag codes
"DURATION":86400000, real period duration in ms
"CNT":{"IMP_T1":96.51217,"IMP_T2":0.00000, energy counter snapshots
"EXP_T1":-0.00000,"EXP_T2":-0.00000,
"IMP_SUM":96.51217,"EXP_SUM":-0.00000}
},
Response object:
{"DAILYPROFILE":{
"tm[days]":1,
"unit":"kWh",
"INST":{ see Profile Entry Object. OID = null!},
"LOCAL_TIME":"2022-08-17T11:58:31+02:00",
"actualOID":11,
"oldestOID":1,
"total_entries":15,
"data":[
{ see Profile Entry Object},
{ see Profile Entry Object},
{ see Profile Entry Object},
...
],
"data_count":11, number of entries contained in data
"NewOIDsMeanwhile":0 number of new entries not covered by this response
}
}
07.02.2023 6 / 14
SENTRON PAC – REST API
1.8. Average values (Aggregation log)
The device has two aggregation stages with individual period times. Each stage must be read out
separately. For available data points, see chapter “Instantaneous measurements”.
“TS” refers to the time when the period was finished.
“value” is the averaged value over the configured “PERIOD”, “min” and “max” refer to the extreme
instantaneous values during the period.
Request: http://device-url/data.json?type=AVG1
http://device-url/data.json?type=AVG2
Response object:
{"AVERAGE_VALUES": {
"LOCAL_TIME": "2022-08-17T11:22:27+02:00",
"STAGE1": {
"PERIOD": "10s",
"TS": "2022-08-17T11:22:20+02:00",
"flags": 0,
"V_L1": {"unit":" V","value":239.4,"max":239.5,"min":239.3},
"V_L2": {"unit":" V","value":239.5,"max":239.6,"min":239.4},
...
}
}}
1.9. Extreme values
The devices track the all-time extremes for each instantaneous data point. For available data points, see
chapter “Instantaneous measurements”
Request: http://device-url/data.json?type=EXTREME_VALUES
Response object:
"EXTREME_VALUES":{
"LOCAL_TIME":"2022-08-17T12:16:44+02:00",
"V_L1":{"max":243.494,"min":0.000,"unit":"V"},
"V_L2":{"max":243.530,"min":0.000,"unit":"V"},
"V_L3":{"max":243.546,"min":0.000,"unit":"V"},
"V_L12":{"max":0.000,"min":0.000,"unit":"V"},
...
}
07.02.2023 7 / 14
SENTRON PAC – REST API
1.10. Waveform data
The devices allow the readout of sample data for oscilloscope like reconstruction of waveform. It can be
used for post spectral analysis. As capturing a waveform may take a while and because multiple clients
could try to do that at the same time, reading is done in a twostep sequence. The first step is to request a
waveform capture and obtain a ticket number for the 2nd step. The waveform can then be read with the
2nd step using the ticket number. The captured buffer will be reserved for the requester for some seconds
or until readout, whatever comes first.
Step 1: Request a waveform capture.
Request: http://device-url/data.json?type=trigger
Response object:
{"TRIGGER": {
"LOCAL_TIME": "2022-08-17T12:19:00+02:00",
"STATE": "ARMED",
"CODE": "2961239854"
}}
Store the code for the 2nd step. State could also be "BUSY". If so, retry after a while.
07.02.2023 8 / 14
SENTRON PAC – REST API
Step 2: Read out the capture data.
Request: http://device-url/data.json?type=waveform&code=xxxxxxxxxx
Response object:
{"WAVEFORM": {
"LOCAL_TIME": "2022-08-17T12:19:21+02:00",
"RECORD_TS": "2022-08-17T12:19:20+02:00",
"STATE": "DONE",
"DATA": {
"Fdec": 4101,
"FactI": 0.000391,
"FactU": 0.015567,
"I_L1": [-12084, -12770, -13382, ...],
"U_L1": [-15365, -16394, -17325, ...],
"I_L2": [-2125, -958, 213, ...],
"U_L2": [-4125, -2529, -915, ...],
"I_L3": [14154, 13675, 13114, ...],
"U_L3": [20337, 19779, 19106, ...]
}
}}
“STATE”: DONE, BUSSY or ERROR.
“ERROR”: Something went wrong. Start over with Step1.
“BUSY”: Device still capturing data. Retry Step2 with the same code.
"Fdec": Rate of the array in Hz. Useful for x-axis scaling. (rem.: This is not the same as the device internal
data rate).
"FactI": Scaling factor for Amps. (Multiply with each I_Lx[n] sample to get A).
"FactU": Scaling factor for Volts.
07.02.2023 9 / 14
SENTRON PAC – REST API
2. Example applications
Displaying the daily active energy logs.
This logfiles can be readout by using the commands explained in point 1.7 of this document:
http://device-url/data.json?type=DAILYPROFILE&start=a&count=b
Also “start” and “count” parameters must be set regarding the given description. To request all entries,
skip parameter “start” and set “-1” for parameter “count”:
http://device-url/data.json?type=DAILYPROFILE&count=-1
For all further steps replace “device-url” with the IP of your PAC device!
2.1. Analyze active energy logs with web browser
Data can be directly viewed via web browser as text in JSON format. As simple improvement several
web-based JSON viewers are available (e.g.: https://jsoneditoronline.org).
Step 1: Copy & paste the modified command to a browser. Data will be shown in browser as text:
Step 2: Select the complete text and copy it.
07.02.2023 10 / 14
SENTRON PAC – REST API
Step 3: Open JSON editor and paste the copied text content:
Data now can be converted in several views to get a better feeling for it or do some analyzes.
07.02.2023 11 / 14
SENTRON PAC – REST API
2.2. Analyze active energy logs with Excel
Step 1: Data can be directly linked to Excel by creating a query to the prepared command:
Step 2: Excel, Power Query Editor is opening. Open “Record”:
Step 3: Open “List” from data:
07.02.2023 12 / 14
SENTRON PAC – REST API
Step 4: Convert “List” to table:
Select required columns:
07.02.2023 13 / 14
SENTRON PAC – REST API
Step 5: Load table to worksheet:
Step 5: Add a Excel diagram:
1) Add a diagram to the worksheet.
2) Select table content as data for the diagram.
3) Diagram data can be refreshed by refreshing the connected queries.
07.02.2023 14 / 14