This paper will elaborate on how to create a dashboard to visualize the device measurements, define alerts and actions in case measurement values exceed certain thresholds.
Cumulocity includes a rule engine to analyze data in realtime and to perform actions based on data. To easily work with this data cumulocity is providing a smart rules builder in Cockpit application which allows you to create rules from templates.
Note: Smart Rules are only visible, if the tenant is subscribed to the Smart Rule application. To manage Smart Rules, the user has to have INVENTORY CREATE permission and either SMART RULE permission or CEP MANAGEMENT permission.
Adding the device to a group
Groups help you organize your devices. In order to add a new group, open the Cockpit application in Cumulocity Core and select the Groups menu entry in the left-hand navigation. Click the “Add Group” link and give your group a name. Click the Add Group button.
Click your newly created group and navigate to the “Sub-assets” tab. Click the “Assign devices” link, select your device and click the “Assign 1 device” button.
This will add the device to a group.
Creating a dashboard:
Dashboards can be used to visualize your measurement data.
Select your device in the left-hand navigation, click the plus icon in the top menu bar and select the “New dashboard” sub-item.
You can leave the default parameters for now. Click “Save”.
Now you have added an empty dashboard. Next, you will add a widget to it. Click the “Add widget” link.
Select “Radial Gauge” as the widget type, enter a title for your widget and enable the measurement data point by selecting any of the existing data points.
Click the little arrow next to the measurement to open the pull-down menu. Add min, max, target, yellow range, and red range values. Save.
Your widget has been added to your dashboard.
Adding smart rules:
Smart rules allow you to trigger alarms in case e.g. measurement thresholds get exceeded. Alarms in turn can trigger actions such as sending an email.
You will first add a smart rule that triggers an alarm once a measurement threshold gets exceeded. To do so, open your device in the left-hand navigation. On the “Data explorer” tab click the “…” icon next to your measurement and click the “Create Smart Rule” link.
Click the “On measurement explicit threshold create alarm” smart rule type.
Add minimum and maximum values, here 30 and 100, leave the other values as is, and click the “Create” button.
Send a new measurement to your device using Postman. Make sure the value is within the red range of your smart rule configuration. Then navigate to the “Alarms” tab. You should see an alarm there now.
You will now create a second smart rule to send an email once such a threshold alarm has been raised. To do so, click on the “…” icon of the threshold alarm and select “Create Smart Rule”.
Add an email to which you would like to send the email, leave the other parameters as is and click “Create”.
Again send a new measurement to your device. Make sure the value is outside the red range of your smart rule configuration.
Then send another measurement value. Make sure the value is within the red range of your smart rule configuration. Now an email should be sent to the address defined in your smart rule.