Tutorial: Listening to a Topic Data Value
- Examine a topic you want to monitor. In this example, we will be monitoring the conveyor as it switched from moving to not moving. The topic it publishes data too is /state. The value it toggles is "data"
![Screen Shot 2021-11-10 at 10.43.30 AM.png 1468](https://files.readme.io/2992f88-Screen_Shot_2021-11-10_at_10.43.30_AM.png)
- Now that we are aware of the topic we want to monitor, we can navigate to the Device Statistics. This is found in the Device Settings.
![Screen Shot 2021-11-10 at 1.11.34 PM.png 374](https://files.readme.io/b4de21a-Screen_Shot_2021-11-10_at_1.11.34_PM.png)
3 On the page, click Add Statistic.
![Screen Shot 2021-11-10 at 10.43.00 AM.png 256](https://files.readme.io/a05a013-Screen_Shot_2021-11-10_at_10.43.00_AM.png)
- A side drawer will appear on the right side. It will ask for the following properties to be filled out:
Type | The statistic category. For this type, we will choose: Topic data value. |
Name | A unique name to describe the statistic. |
Description | A long form input that can describe the statistic in more detail. |
Force Denominator | This can be omitted. It is used when calculating the graph representation of the data. |
Compute When | Expected Available or when Active. This will control when the statistic is recorded as a value. |
Topic | The topic of choice to evaluate. In our example, we are looking at the /state topic. |
Data Index | The data property of the topic. In this example we are looking at the data property. This would be denoted by ["data"]. |
Aggregation | How often do you want the statistic to be calculated? In this example we are choosing every minute. |
For example, with the form filled out:
![Screen Shot 2021-11-10 at 10.43.20 AM.png 620](https://files.readme.io/27a8f06-Screen_Shot_2021-11-10_at_10.43.20_AM.png)
You will see the statistic show up in the list of statistics.
![Screen Shot 2021-11-10 at 10.43.11 AM.png 3406](https://files.readme.io/5233055-Screen_Shot_2021-11-10_at_10.43.11_AM.png)
- Next navigate to the fleets. On the left side nav, click Fleets.
![Screen Shot 2021-11-10 at 1.53.45 PM.png 158](https://files.readme.io/da96bf2-Screen_Shot_2021-11-10_at_1.53.45_PM.png)
- Choose the fleet of choice you want to see the statistic in.
![Screen Shot 2021-11-10 at 1.54.42 PM.png 530](https://files.readme.io/7ff00c1-Screen_Shot_2021-11-10_at_1.54.42_PM.png)
- For this example, we are choosing the Freedom Factory. Click the statistics icon. It is the heartbeat icon.
![Screen Shot 2021-11-10 at 1.55.22 PM.png 248](https://files.readme.io/f710de9-Screen_Shot_2021-11-10_at_1.55.22_PM.png)
- You will be navigated to the statistics section of the fleet. On the top right of this page, click Manage Statistics.
![Screen Shot 2021-11-10 at 1.12.57 PM.png 316](https://files.readme.io/97a2ba4-Screen_Shot_2021-11-10_at_1.12.57_PM.png)
- A side drawer will appear. At the bottom of this drawer, click Add Statistic.
![Screen Shot 2021-11-10 at 10.42.42 AM.png 276](https://files.readme.io/17f2671-Screen_Shot_2021-11-10_at_10.42.42_AM.png)
- Fill out the form with the statistic that has been created. Click Save.
![Screen Shot 2021-11-10 at 10.42.32 AM.png 620](https://files.readme.io/baa3eb9-Screen_Shot_2021-11-10_at_10.42.32_AM.png)
Statistic Calculations
Statistics will start generating upon the time they are created. You will not see historical data being used to generate statistics. In this case, I have let some time pass to show over the last week the conveyor movement.
![Screen Shot 2021-11-10 at 10.42.20 AM.png 3024](https://files.readme.io/4b8fc20-Screen_Shot_2021-11-10_at_10.42.20_AM.png)
Updated over 2 years ago