Skip to content

Download historical data

The historical data of each device is in text files (datalogs) on its device server. Each file covers one day, one month or the full history. You need read permission on the device.

For an export without code, use the reports of the app. See your data.

  1. Find the server of the device. Call get_device_info.php and read the device_server field. See the REST API.
  2. Find the column order. Call get_device_definitions.php?family_id=<family> and read readings and output_names.
  3. Calculate the level and the file number (bin) for the period that you want.
  4. Download each file from the server of the device.
  5. Join the rows, sort them by timestamp and fill in the empty fields.
Terminal window
curl --compressed \
-H "Authorization: Bearer-API YOUR_API_KEY" \
"https://DEVICE_SERVER/datalogs.php?serialno=e11:123&id=0.20740&ver=2"

Replace DEVICE_SERVER with the value of the device_server field of the device.

Parameter Value
serialno The serial number of the device
id <level>.<bin>, for example 0.20740
ver 2

For authentication, send the header Authorization: Bearer-API YOUR_API_KEY or Authorization: Bearer YOUR_ACCESS_TOKEN.

The server can send the file compressed (gzip or br). The curl option --compressed decompresses it.

HTTP code Meaning
200 The file, as text/plain
400 Wrong serialno or id
403 You do not have read permission on the device
404 There is no data for this file

All calculations use UTC.

Level One file per Bin calculation Example
0 Day floor(unix_seconds / 86400) 14 October 2026 = 0.20740
1 Month (year - 1970) * 12 + (month - 1) October 2026 = 1.681
2 Full history Always m 2.m

Level 0 has all the rows of the day. Level 1 has about one row per day. Level 2 has about one row per month.

The app uses level 0 for periods up to 7 days and level 1 for periods up to 5 months. For longer periods it uses 2.m.

Each row is one measurement. The fields are separated by ;.

timestamp;reading1;reading2;...;readingN;output1;...;outputM
  • The timestamp is unix seconds (UTC). It can have decimals.
  • Then come the readings, in the order of the family readings.
  • Then come the outputs, in the order of output_names.
  • An empty field means that the value did not change. Use the last value from an earlier row.
  • The value 2147483648 means that the reading is missing.
  • The rows are not always sorted. Sort them by timestamp.

A device of family e11 has readings = ["T", "GI", "GIC", "GI2", "GI2C"] and no outputs.

1791936198.977;2120;1;0;1;0
Field Value Meaning
timestamp 1791936198.977 Time of the measurement
T 2120 21.20 °C, because the conversion of T is divide_by_100
GI 1 State of the first input
GIC 0 Counter of the first input
GI2 1 State of the second input
GI2C 0 Counter of the second input

You find the conversions and the units in the readings dictionary of the definitions. See the REST API.

This example downloads the last 3 days of a device.

Terminal window
SERVER=DEVICE_SERVER
SN=e11:123
TODAY=$(( $(date -u +%s) / 86400 ))
for BIN in $(seq $((TODAY - 2)) $TODAY); do
curl -s --compressed \
-H "Authorization: Bearer-API YOUR_API_KEY" \
"https://$SERVER/datalogs.php?serialno=$SN&id=0.$BIN&ver=2"
done | sort -t';' -k1,1n

The MCP server has the get_device_history tool. It accepts the same levels and bins.

Chat with support