Query executor

The scenario will allow you to create a widget displaying historical sensor data.

The system database stores data about each topic and all its changes. The system limits the data output to avoid overloading the server. You need to create SQL queries to obtain the necessary information from the database. The example below will show you how to display the selected topic's average data for the last 6 hours.


On the Market page, open the Extensions tab and click on the download icon near the selected item.

Market section

Go to the Scenarios page, click the “Create scenario” list and select the scenario you need.


The scenario settings window includes two fields:

  • Scenario’s Name - the unique name under which the scenario is used in the system.
  • Query – a field for entering a query into the database.

The scenario settings window

The scenario settings window

In this example, there is a topic with int values that need to be averaged over the past six hours. To do this, we wrote the following database query:

SELECT mean("number") FROM timelines WHERE ("topic" = 'sweet-home/dd-ivan/low-battery/sensor1') AND time >= now() - 6h

The scenario settings window

After running the scenario, the required value appeared in the Threshold:

The Threshold

The average value of the required topic for the last six hours is displayed on the widget:

The widget

results matching ""

    No results matching ""