Reports & scripts
Thermite SCADA has no report designer. A report is a script that runs beside the gateway, written by you or your agent in any language. It reads what the gateway already serves and produces the file, message, or database rows you want. This page shows what a script can read, and scripts from real runs with the output they produced.
What a script can read.
| Data | Where | What you get |
|---|---|---|
| Tag history | GET /p/<slug>/api/history/<tag path> | Raw samples with quality and timestamps, or aggregated intervals (avg, min, max, count, first, last). |
| Live values | GET /p/<slug>/api/tags/<tag path> | The current value, quality, and timestamp. The WebSocket at /p/<slug>/api/ws/tags pushes changes as they happen. |
| Current alarms | GET /p/<slug>/api/alarms | Alarms that are active or waiting for acknowledgment, with state, priority, and value. |
| Alarm record | site/logs/alarms.jsonl | One JSON line for every alarm transition, appended as it happens. |
| Your own tables | PostgreSQL | Transaction groups write production values to tables you define when a trigger tag changes. |
The gateway does not run scripts itself. You start them the way you start anything else on the server: cron for a schedule, a service for a script that waits for something to happen. The HTTP & WebSocket API page has every parameter.
An hourly report for one furnace.
We asked an agent for an hourly report on a holding furnace, as a text file a supervisor can read and a CSV with the same numbers: ten-minute rows of minimum, average, and maximum bath temperature, the lowest level, and the minutes the charging door was open, then the alarms raised in the hour and the number of charges. It wrote one Python script, 389 lines with no packages to install. History comes over HTTP. Alarm times come from the alarm record, because the alarms address shows current state only. This is the report for one hour of the simulated furnace:
HF-1 HOLDING FURNACE - HOURLY REPORT
Hour: 2026-11-12T13:00:00.000-05:00 to 2026-11-12T14:00:00.000-05:00 (America/New_York; end excluded)
UTC: 2026-11-12T18:00:00Z to 2026-11-12T19:00:00Z
Journal read at: 2026-11-12T14:07:15.374-05:00
Time Bath min F Bath avg F Bath max F Low level % Door open min
----------- ---------- ---------- ---------- ----------- -------------
13:00-13:10 1323.9 1350.9 1410.3 36.8 1.833
13:10-13:20 1331.3 1360.4 1409.8 38.8 0.116
13:20-13:30 1325.9 1364.8 1411.3 43.8 1.717
13:30-13:40 1326.4 1366.3 1416.3 37.0 1.833
13:40-13:50 1324.0 1352.2 1405.4 36.3 1.833
13:50-14:00 1328.8 1355.9 1401.4 39.3 0.616
Alarms raised in this hour (active duration ends at return to normal):
2026-11-12T13:05:49.148-05:00 hf1/level:lo (medium)
Active 57.000 s; trip 39.5 %; RTN 2026-11-12T13:06:46.148-05:00
2026-11-12T13:09:31.147-05:00 hf1/bath_temp:hi (high)
Active 79.002 s; trip 1405.5 degF; RTN 2026-11-12T13:10:50.149-05:00
2026-11-12T13:19:36.849-05:00 hf1/level:lo (medium)
Active 16.198 s; trip 39.6 %; RTN 2026-11-12T13:19:53.047-05:00
2026-11-12T13:22:39.047-05:00 hf1/bath_temp:hi (high)
Active 103.002 s; trip 1405.4 degF; RTN 2026-11-12T13:24:22.048-05:00
2026-11-12T13:33:08.036-05:00 hf1/level:lo (medium)
Active 3.997 s; trip 38.9 %; RTN 2026-11-12T13:33:12.033-05:00
2026-11-12T13:35:48.034-05:00 hf1/bath_temp:hi (high)
Active 78.000 s; trip 1406.7 degF; RTN 2026-11-12T13:37:06.034-05:00
2026-11-12T13:45:16.035-05:00 hf1/level:lo (medium)
Active 61.001 s; trip 39.9 %; RTN 2026-11-12T13:46:17.036-05:00
2026-11-12T13:49:03.037-05:00 hf1/bath_temp:hi (high)
Active 69.998 s; trip 1405.4 degF; RTN 2026-11-12T13:50:13.036-05:00
2026-11-12T13:59:03.049-05:00 hf1/level:lo (medium)
Active 19.998 s; trip 39.8 %; RTN 2026-11-12T13:59:23.047-05:00
Charges (door openings) in hour: 5
Bath figures use good recorded samples; average is sample-weighted.
Deadbands: bath temperature 0.5 F; level 0.2 percentage points.
Door minutes integrate last recorded good boolean state across row/hour boundaries.
Charges count closed-to-open edges in the hour; a carry-in opening is not a new charge.
Alarm durations use active -> RTN, irrespective of acknowledgement.
Only retained journal events are available; removed events cannot be reconstructed.
History: HTTP GET http://localhost:8432/p/cast-house/api/history/{path} (no direct PostgreSQL reads).
Alarms: site/logs/alarms.jsonl (HTTP alarm state does not contain event history). The files as written: the report and the CSV. The script takes the hour to report as an argument, so a missed hour can be run again. Cron runs it five minutes past every hour:
# crontab
5 * * * * /usr/bin/python3 /opt/thermite-demo/scripts/hf1_hourly.py
A snapshot each time an alarm goes active.
We asked an agent for a script that saves the fifteen minutes of bath temperature and level before each high-temperature alarm on a holding furnace, with a short summary. It was not to change the project or restart the gateway. It watched the alarm record, where each transition is one line:
{"timestamp":"2026-11-12T17:56:27.249890Z","gateway_id":"01a1d0e4-b7ae-76ff-8285-491c9c4da0f4","project_id":"01a1d088-16b1-75fe-b6ce-cb941f742be3","source_path":"hf1/bath_temp","alarm_id":"hf1/bath_temp:hi","occurrence":1,"condition":"hi","priority":"high","transition":"active","new_state":"unacked_active","value":1401.0,"details":{"deadband":0.0,"limit":1400.0}} When a line for hf1/bath_temp:hi arrives with "transition":"active", the script reads raw history for the window over HTTP and writes the two files. It ran until the simulated furnace tripped its alarm. Its log:
2026-11-12T18:19:39.321509+00:00 Watching site/logs/alarms.jsonl for hf1/bath_temp:hi; history from http://localhost:8432/p/cast-house 2026-11-12T18:22:39.567520+00:00 Activation 2026-11-12T18:22:39.047191Z, occurrence 3 2026-11-12T18:22:54.089041+00:00 Saved hf1-bath-temp-hi_2026-11-12T18-22-39.047191Z.csv and hf1-bath-temp-hi_2026-11-12T18-22-39.047191Z.txt: 674 samples
And the summary it wrote:
HF-1 high-temperature alarm: 2026-11-12T18:22:39.047191Z (UTC) Occurrence: 3; project: 01a1d088-16b1-75fe-b6ce-cb941f742be3 Window: 2026-11-12T18:07:39.047191+00:00 through 2026-11-12T18:22:39.047191+00:00 (inclusive) Trip value: 1405.4 degF (alarm activation event) Peak recorded temperature: 1410.3 degF at 2026-11-12T18:09:45.148Z Level at alarm: 76.2 %; last good sample 2026-11-12T18:22:39.047Z (0.000 s before alarm) History is recorded on change with deadbands; no interpolation. Summary uses good samples only; CSV retains every recorded quality. Samples: hf1/bath_temp: 338; first 2026-11-12T18:07:40.148Z; last 2026-11-12T18:22:39.047Z; hf1/level: 336; first 2026-11-12T18:07:39.147Z; last 2026-11-12T18:22:39.047Z
The script is 158 lines of Python with no packages to install. It is here as the agent wrote it: alarm_snapshots.py. Read it before you use it; the gateway address and paths are from our test machine. On your server, run it as a service so it starts with the machine.
To start a script on a tag change instead of an alarm, subscribe to the tag on the WebSocket and act on the values as they arrive.
Which alarms cost the most time.
We asked an agent which alarms were costing the most on the same furnace: for each alarm in a window, how many times it went active, the total and the longest time active, the worst value reached, and how many were still unacknowledged. It wrote one Python script that pairs each activation in the alarm record with its return to normal and reads the worst value from history over HTTP. For one hour of the simulated furnace:
python3 scripts/alarm_ranking.py --start 2026-11-12T18:00:00Z --end 2026-11-12T19:00:00Z --site site
Project: cast-house (01a1d088-16b1-75fe-b6ce-cb941f742be3) Window UTC: [2026-11-12T18:00:00Z, 2026-11-12T19:00:00Z) Alarm record: site/logs/alarms.jsonl Active time clipped to window; unacked occurrences as of window end (including RTN). Worst recorded: good history while active + activation values; hi=max, lo=min. History has deadbands and recorder lag; retained journal only; times are HH:MM:SS.sss. Alarm Activations Total active Longest active Worst recorded Unacked@end ---------------- ----------- ------------ -------------- -------------- ----------- hf1/bath_temp:hi 4 00:05:30.002 00:01:43.002 1416.3 degF 4 hf1/level:lo 5 00:02:38.194 00:01:01.001 36.3 % 5 Alarm rate: 9.000 activations/hour (9 activations / 1 hours)
The same script takes --since 30m or any start and end. Run it by hand when you want to know, or from cron for a ranking every morning.
Keeping history to the length you want.
History is in your PostgreSQL database, in the tag_history table. How long you keep it is a statement you schedule. This one keeps ninety days; cron runs it every night at 02:30:
# crontab: keep ninety days of history
30 2 * * * psql -d thermite -c "DELETE FROM tag_history WHERE timestamp < now() - interval '90 days'"
Because it is your database, its own tools apply too: partitioning, backups, and read-only users for the people who write reports.
Ask for the report you want.
Every script on this page started as a plain request. Say what you want to see, where it should be saved, and when it should run. Ask the agent to run it once and show you the result before you schedule it. Work with your agent has the prompt to start from.