Notifications are very useful when developing applications that require someone’s attention if something happens to it.
In this tutorial, you will learn how to notify someone when the temperature of a device reaches warning levels.
Let’s simulate a machine that heats over time and if the temperature goes over 71 someone should take action.
First, create a custom https device called “Custom Device” that will simulate your real device. Click on the Devices tab in the menu.
Note: Notifications can be implemented for any device type. We are using a custom https device for simplicity because it initializes with no additional dashboards or payload parsers.
Name your device and save
Now, let’s create a dashboard to show the temperature of your device.
Go to dashboards, then press the addition symbol on the right.
Now that we have our dashboard and widget set up, we will create an action. Click “Actions” in the menu.
After creating the action, select the device associated with the action and the variable that will trigger it. Also add a trigger unlock condition. Here we will set the unlock trigger to unlock when the temperature falls below 35. In a real world application, a device would repeatedly send data the device bucket. If there was no unlock condition, the user would receive multiple notifications for the same issue. By creating an unlock condition, we can prevent that from happening. Now, the action will not be triggered following the initial trigger unless the temperature falls below 35.
Note If the device receives values for the temperature variable that exceed 40, the action will be triggered. Because we initialized temperature at 71, sending that payload would trigger the action.
Now, re-send the default payload.
Tips: watch the video for this here