Data Processing on thingsboard

Here we will see how to process data or how to perform any operation on data and how to display result on on widget. For understanding purpose we will perform multiplication operation on data and result will display on dashboard widget. We already created dashboard for Showing Temperature value. so here we will perform multiplication operation on Temperature value. Please click on the following link to know , how Temperature dashboard is created.
Creating  a dashboard on thingsboard

1)Click on DASHBOARDS
Click anywhere on Your Dashboard

2)Click on enter edit mode

3)Click on Edit widget

4)Click on edit of your data source.
If you observe in below image Maximum Datasource allowed is 1.

5)Tick Use data-processing function
Using Following ways, you can add any kind of data processing on individual datasource. Different way, you can perform processing , those ways are given below. Processing means performing any operation on data.  Whatever value you return that is going display on your widget.

Example: copy and paste this code
return value*2; OR
return value+100; 

or you can try this way also

a=200; 
b=200;
value=a+b;
return value;

or you can try this way also

return (value==25)?100:200;

6)Click on Apply changes

7)Click on Apply changes

8)If you see in below image, initially Temperature value was 25 but now because of post processing function Temperature value is 50. Similar way you can add any kind of data processing on individual datasource.

You may also like...

Leave a Reply