Actions is a very powerful feature that gives you total control over your devices based on events determined by you. More than sending an e-mail or SMS based on certain conditions, with Actions you start tasks to send data back to the device, run scripts in the Analysis, and make a HTTP Post endpoint (very helpful when integrating Tago with other back-end systems). With these capabilities combined, there are limitless possibilities to create any event condition, not limited to a simple if/else condition.

Creating Actions

To create a new Action, just click on the button ‘Action’ located at the sidebar, then click on + (the top right button). Give a name for your action and click Save.

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/ICVJY9eExR2-Px3VIE4F_O1EmKBbF-24ROdBx0kaaj4/create_action-tVI.png


Defining Actions

The first thing to do when configuring an Action is to define which action you want it to take. Here is a list of options to be defined:

  1. Push Notification
  2. Send Email
  3. Send SMS
  4. Run Analysis
  5. Publish to MQTT
  6. Post data to end-point using HTTP

Learn about each Action here.

Defining condition

In order to initiate an action process, certain conditions should be met. Internally, Tago uses triggers as flags to monitor this process.

Set Trigger

One valid condition to start the action is when the selected variable meets the criteria defined in Set Trigger.

To configure how the event will be initiated, you need to configure the triggers. Enter with the variable to be tested (it is tested every time a new value arrives), the Condition, and the value to be compared against. When the condition is true, the trigger is set. Same thing for the condition defined to reset trigger.

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/UDn1futcXRxRs7o2TN-eBb-BkBf2f1y2d7A9DecOpQM/set_trigger-7MU.png

The available test conditions are:

  1. Less than - condition is true when the value of the variable is less than the value defined
  2. Greater than - condition is true when the value of the variable is greater than the value defined
  3. Equal to - condition is true when the value of the variable is equal to the value defined
  4. Different from - condition is true when the value of the variable is different from the value defined
  5. Any- condition is true whenever a new value of the variable is sent to the bucket

Another condition depends on the Lock trigger after action is taken switch status. If it is NO, the action will be taken solely based on the Set Trigger condition explained above. If it is set to YES, the condition above will only be tested if the Trigger is not Locked. The status of the trigger can be manually changed as showed below, that is under the session ‘More’. A more common option to unlock the trigger is to use the Reset Trigger setup.

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/mOFJ3iunDZEReNKxkiEQAC-CGIgSw9pKhlrlsDeRRZk/trigger_locked-Co0.png

Note: Combined logic tests can be easily implemented in the Analysis. For example, if you want to take an action to send an SMS when the (temperature > 95C) AND (time_of_day == night) AND (User_at_home == false), you can simply create an Action to Run a script in Analysis every time the new temperature variable arrives, and just write a simple script to make the logic test. This method is very powerful to test basically any complex combination.

Reset Trigger

Each time a Set Trigger condition is met, the trigger is locked if the Lock trigger after action is takenswitch is set YES. In this case, the Set Trigger condition will only be tested again when the Reset Trigger condition is met. This is helpful to create an hysteresis for example.

However, if the Lock trigger after action is taken switch is set NO, the trigger will never be locked, and any time that the Set Trigger condition is met, it will take the defined action. Depending on your logic, it may be undesirable.

One example of an undesirable situation could occur when you want to receive only one SMS when the temperature crosses above 95 C, but instead you receive one SMS for each time a new value of temperature above 95 C is sent (unnecessary and costly). You may want to implement an hysteresis using a Reset Trigger condition. If you define the condition to reset when temperature < 90 C for example, it would prevent this issue. Only one SMS would be sent, and the system would be locked until the temperature goes below 90 C. Which seems much more reasonable in this example.