Daily Energy Consumption Total
Aggregate a daily kWh, m³, or unit total from a per-period consumption delta. For pulse counters, cumulative meters, and dropping gauge sensors, pair with a per-period delta CF first.
Who it’s for
Utility, energy, and building operators asking “how much was used today?”, “are we above yesterday’s total?”, “did the night shift draw more than the day shift?” — when the headline number on the dashboard is a per-day total of an underlying per-period delta stream.
What it does
Aggregates one daily total from a per-period delta — the default reads
energyKwhConsumed and emits dailyEnergyConsumption. Each input
sample represents the consumption since the last report (e.g. kWh
delivered in this reporting interval).
How to set up
If your device already publishes a per-period delta (e.g. kWh consumed
since the last report), the template works as-is — just set the
source argument’s Time series key to match.
Most devices publish a cumulative counter or a dropping gauge instead.
Pair with one of the upstream Script templates below — it converts the
raw reading into a per-period delta this template can aggregate. To
connect, change the source argument’s Time series key to the
upstream CF’s output key (readingsDelta), and rename the
Metric name to match your domain (e.g. dailyEnergyConsumption →
dailyWaterConsumption).
For cumulative counters that only go up (lifetime totals, water meter pulse counters, energy totals):
Calculate Delta from Pulse CounterFor dropping gauges that decrease as something is used (fuel level, battery state-of-charge, inventory level):
Calculate Delta from Tank Level SensorHow to customize
- To aggregate a different telemetry key — change the Time
series key on the
sourceargument (e.g.energyKwhConsumed→waterLiterConsumed). - To rename the output for a different domain — change the
Metric name (e.g.
dailyEnergyConsumption→dailyWaterConsumption) so downstream dashboards and alarms bind to a meaningful key. - To compute a different roll-up — change the metric’s Function
to
AVG,MIN,MAX, orCOUNT, or click Add metric for additional outputs. Each metric defines one output key and its function. - To change the aggregation window — change Aggregate interval type from Day to Hour, Week (Mon - Sun), Month, or Custom. Align Time zone with the operator’s local time so window boundaries land where they expect.
- To shift the interval start by a fixed amount — enable Apply offset to aggregation interval and set Offset value in minutes. For example, an offset of 10 makes hourly windows fire at HH:10 instead of HH:00.
- To recalculate intervals when telemetry arrives late — enable Apply await timeout for delayed telemetry and set the Duration. When a reading arrives after the interval ends, the aggregate for that interval is recomputed. Useful for LoRaWAN, NB-IoT, or batched uploads where data can lag minutes to hours behind the wall clock.
- To turn off in-progress “current interval so far” updates — disable Produce intermediate result. The CF then emits only one value per interval, at the boundary.
- To turn off the database write, WebSocket push, or downstream CF re-evaluation — under Process right away, toggle Save to time series, Save to latest values, Send to WebSockets, or Send to Calculated fields.
- To filter, transform, or forward the result to external systems — switch Strategy to Process via Rule Chains. Rule nodes then receive the output and can drop it, change it, save it conditionally, push it to an external system, or anything else the chain defines.
See also
To alert when the daily total exceeds a budget, pair this calculated field with the alarm rule template below:
Daily Energy Budget AlarmShare Your Calculated Field with the Community
Built a useful data transformation? Export it as a JSON from ThingsBoard and publish it to the IoT Hub. Share it with thousands of ThingsBoard developers worldwide.