Getting started with IOStash Rules Engine

A brief overview of the triggers and you'll learn how to create rule based triggers for devices using the IOStash platform


This guide will help you learn the basics of IOStash rule based triggers.

Rules are simply conditions that will trigger certain actions. These rules can be used to trigger actions that can perform operations like, sending an email when a certain condition is met. IOStash supports 3 types of actions:

  1. Email trigger - Sends an email when the rule is triggered.
  2. Web hook trigger - Sends a GET/POST request to a web URL
  3. Device Action - Sends data to another device defined in IOStash

Rules are at the core of IOStash trigger engine, they are applied to DataPoints of devices and if they return true, corresponding action will be triggered automatically.

Creating a rule

To define a new rule, login to your dashboard and click on Rules > Add New Rule

IOStash create trigger page

Fill out the basic description of the trigger and click next.

Now, select the data point you wish to associate with the trigger. This particular data point will be evaluated and is responsible for triggering the action

IOStash create trigger page 2

Select the datapoint of interest. Here, we're selecting the temperature datapoint we defined in the Getting Started Guide

Next, define the rule or condition for triggering the action

IOStash create rule page 3

Here, we have set the rule as when value > 30. So whenever the value pushed to the temperature datapoint becomes > 30, this rule will be triggered and corresponding action will be fired. Like >, there are many other expressions available for use.

To set the action for this rule, click on Next

IOStash create trigger page 4

We're going to define an Email trigger, select EMail and click Next

IOStash create trigger page 5

IOStash supports the following variables to be used with a trigger body:

  • %datapoint% - Data point responsible for the trigger
  • %deviceid% - Id of the device which triggered the rule
  • %value% - Value that triggered the rule
  • %triggername% - Name of the trigger
  • %triggerdescription% - Description of the trigger
  • %commitTime% - Time of data commit that triggered the rule

If any of these variables are defined in the trigger action body, they'll be replaced with their corresponding values by the IOStash platform before sending it. For example, The data point value is: %value% will be sent as The data point value is: 31.

When a value > 30 is pushed by the device, we'll receive an email to the address we defined:

IOStash email trigger

Trigger email body supports full HTML, we received the above mail because we haven't wrote any formatting code.



Other trigger types

While using other trigger types, keep in mind that valid JSON data format is to be used in all parameter fields. For example, in a web hook trigger, to send a variable 'input' via POST, you need to specify {"input": %value%} to define it. Braces are mandatory.

For support, please feel free to mail us at [email protected]