New: the AI firewall watches every module and explains each incident in plain words. See how it works

Aggregates and rollups

How numeric readings are summarised per minute, hour and day, which resolution a time window reads, the seven aggregate functions and increase for counters.

Reading every raw value of a year would be slow and would not fit on a chart. Hermetry therefore summarises numeric readings per minute, hour and day, and reads the summary that fits the window you ask for. This page explains the summaries, how the resolution is chosen and what each aggregate function returns.

The summaries

For every numeric key of every device, the store keeps five figures per bucket:

FigureMeaning
sumThe sum of the values in the bucket
countHow many values arrived in the bucket
minThe smallest value
maxThe largest value
lastThe value with the latest timestamp in the bucket
LevelBucketKept for
1-minute aggregates1 minuteYour retention class, at most 31 days
Hour rollups1 hourYour full retention class
Day rollups1 day, midnight to midnight UTCYour full retention class

All buckets are aligned to UTC. The minute summaries are computed by a job that runs every minute; the hour and day rollups are derived from them. A reading that arrives after its minute was summarised marks that minute again, so late readings are included. A freshly stored reading can take a minute or two to appear in summaries; raw reads (windows up to 24 hours) see it at once.

Text, true/false and JSON values are not summarised. See Numbers, text and true/false values.

Which resolution a window reads

With the bucket auto (the default for charts and the API):

Window lengthResolution
Up to 24 hoursRaw values, every reading
Up to 10,000 minutes (about 6.9 days, so a full 7-day window already reads hours)1 minute
Up to 10,000 hours (about 416 days)1 hour
Longer1 day

A window may hold at most 10,000 buckets at the chosen resolution. If you ask for a fixed resolution that would need more (for example 1m over 30 days), the API answers 400 with the code range_too_large. Ask for a coarser bucket or a shorter window.

A window that reaches further back than a level is kept returns nothing for the missing part. For example, with the 365-day class, 1m buckets older than 31 days are gone; ask for 1h instead.

The aggregate functions

Each bucket returns one value, computed from its five figures:

FunctionValue per bucketUse it for
avg (default)sum / countTemperatures, levels, pressures
minThe smallest valueLowest level, coldest point
maxThe largest valuePeaks, “did it happen” for 0/1 keys
lastThe last valueMeter readings, states, setpoints
sumThe sum of the valuesValues that are already per-interval amounts (litres in this interval, events as 1)
countThe number of readingsReporting rate, data completeness
increaseHow much a counter roseEnergy and water meters, pulse totals

avg is a plain average of the readings in the bucket, not weighted by time. A device that reports more often in some periods weighs those periods more.

When a raw window is read (up to 24 hours), the aggregate is not applied: you get every stored value. Charts that show raw points and a summary side by side can therefore show more detail for the last day than for older days.

increase, for counters

Counters only grow (kWh, m³, pulses) until they restart from zero. increase turns them into consumption per bucket:

  • Each bucket’s value is its last minus the previous bucket’s last.
  • If the value went down (the counter restarted), the bucket’s last is taken as the rise, counting from zero.
  • The first bucket of the window counts what rose inside it: its last minus its min.

Example with hourly buckets of an energy meter:

Hourlastincrease
08:001,200.04.0 (first bucket: last 1,200.0 – min 1,196.0)
09:001,212.512.5
10:001,221.08.5
11:003.03.0 (the meter restarted)

Notes:

  • A rise across a gap is counted in the first bucket after the gap.
  • A counter that restarts and then rises above its old value within one bucket is not seen as a restart.
  • Use increase on the raw counter, never on a key that is already a per-interval amount; use sum for that.

Using the summaries

WhereHow you choose
Dashboard chart cardsThe card’s Aggregate setting and the board’s time window. See Chart cards and Data sources and parameters.
The device’s Telemetry tabAlways avg, with the window you pick. See The device’s Telemetry tab.
The APIbucket and agg on GET /api/telemetry/series. See The history API.
FlowsThe Statistics block computes figures over a message window in the flow itself. See Counters, statistics and watchdogs.

Local days and months

Day rollups are UTC days. For a daily total in another time zone, read 1h buckets and add the hours of each local day yourself; for zones with a half-hour offset, read 1m buckets (up to 31 days back). See the example in The history API.