Working with time series data

In this example, we will use the time series database to fetch data for a given metric and compute the minimal value. image

We will use the getMetric sensor with the following properties: fetching data for the past minute (PT1M notation), for the metric temperature, without any aggregation. We also make use of the binding feature in order to bind the input argument (resource) to the bound resource on the node level node.resourceId. We could have as well just used the testresource directly as the input argument, but decided to use binding feature, to keep it consistent with stream based use cases.


Once data is collected, it will be passed through the transformer:

  min: Math.min(...$${nodes.getMetric_1.rawData.series}.map(x => x[1]).flat())

Finally, the debug message is formated as Min value is "${nodes.transformer_1.rawData.min}"

If we are to set a condition, for instance to check if the minimum value is below the threshold, we can add the condition node, like this:

const THR = 10
$${nodes.transformer_1.rawData.min} > THR