Skip to content
Stand with Ukraine flag

Save Calculations to ThingsBoard

When a calculated field is enabled, Trendz automatically writes its results to ThingsBoard as telemetry under the key _ECD_{KEY}. This makes calculated metrics available anywhere ThingsBoard supports telemetry — dashboards, alarm rules, rule chains, predictions, and further calculations.

Disabling a calculation field stops new writes but never deletes existing telemetry already stored in ThingsBoard.

Trendz calculated field
│ writes telemetry (_ECD_yourKey)
ThingsBoard entity
┌───────┴────────────────────────────────┐
│ │
▼ ▼
Alarm Rules Dashboards / Rule Engine /
(threshold alerts) Predictions / Anomaly models

Two jobs control when data is written:

JobWhen it runsPurpose
ReprocessOnce, on demandBackfill historical data for the selected time range
RefreshScheduled (recurring)Keep telemetry up to date at a defined frequency

Before enabling a calculation, verify the key parameters that determine how data will appear in ThingsBoard:

ParameterDescription
Grouping IntervalTime bucket size — e.g. HOUR stores one point per hour in ThingsBoard.
AggregationHow values within a bucket are combined — e.g. SUM totals all readings in the hour.
TimeTime range used by the refresh job. Choose a range that covers what each refresh cycle needs to process.

Recommended time settings by job frequency:

FrequencyRecommended time range
Minute / HourToday
DayLast 7 days
WeekLast 14 days
MonthLast 3 months
  1. Open the calculation field and verify Grouping Interval, Aggregation, and Time.

  2. Click Save Field to apply changes.

  3. In the confirmation dialog, click Save.

  4. You will be prompted to enable the calculation field and run a refresh task. You can do it now or later.

Once saved, the calculation field appears in the Calculation folder in the business entities panel.

The Reprocess Task runs once to compute and store historical data in ThingsBoard for the selected time range and entities.

  1. Open the Tasks tab and click Run Reprocess Task.

  2. Select the time range to reprocess.

  3. Choose the target entities — you can apply the calculation to all entities with the same entity profile.

  4. Click Run.

After the job completes, the telemetry appears in ThingsBoard under the key _ECD_{KEY}.

The Refresh Task runs on a recurring schedule to keep ThingsBoard telemetry up to date.

  1. Click the Jobs button in the calculation field editor.

  2. Enable calculation result saving.

  3. Set the start date — the earliest point from which data will be saved.

  4. Define the frequency — how often the job runs. The minimum interval is 1 minute (not recommended due to load); on Trendz Cloud the minimum is 1 hour.

  5. Choose target entities — select individual entities or all entities with the same profile for automatic updates.

  6. Click Save.

Once saved, the calculation shows an Enabled status. Telemetry will update automatically at the specified frequency for the selected entities.

Once the refresh and reprocess jobs are running, the calculated telemetry is continuously updated in ThingsBoard and available everywhere telemetry is supported.

You can create alarm rules based on the calculated telemetry key (_ECD_{KEY}) directly in the entity profile.

Example: A calculation produces temperature deviation values for each sensor relative to the building average. When the deviation exceeds 10°, an alarm is triggered. When it falls back below the threshold, the alarm is cleared.

  1. Open the entity profile where the calculation is created.

  2. Navigate to Alarm Rules and toggle Edit mode.

  3. Click Add alarm rule and configure the create and clear conditions using the _ECD_ telemetry key.

  4. Click Apply changes.

Once saved, the alarm rules are active.

Visualize the metric in any Trendz widget — line chart, heatmap, state view, and others. See Trendz Visualizations for the full list of chart types.

To embed a Trendz view into a ThingsBoard dashboard, see Embed Trendz Views.

Use Trendz Prediction Models to forecast future values of the saved metric and visualize them alongside the historical data.

Detect anomalies or outages in the saved metric using Trendz Anomaly Models. When an anomaly is detected, you can automatically trigger an alarm in ThingsBoard.