All Collections
User Guides
Events: Creating Conditional Events and Alerts
Events: Creating Conditional Events and Alerts
How to create Conditional Events to trigger sensor and actuator data-based Alerts.
David Sepúlveda avatar
Written by David Sepúlveda
Updated over a week ago

Table of Contents:

1. Types of Events

Ubidots already supports integrated events to allow you to send Alerts and notifications to those who need to know when they need to know.


Ubidots' pre-built integrations include: 

  1. Email notifications

  2. SMS notifications

  3. WebHook events - learn more

  4. Telegram notifications - learn more

  5. Slack notifications - learn more

  6. Voice Call notifications - learn more

  7. Back to Normal notification - learn more

  8. Geofence notifications - learn more

2. When and how does an Ubidots Event trigger?

The figure below describes how the Events Engine triggers alerts inside an active event window. Note that data (blue line) passes through the Threshold triggering an event; then the data must fall below the threshold again before Ubidots triggers the next event.

Please note that after an alert is triggered, subsequent values will not be triggered again, even if they comply with the trigger conditions. A second trigger cannot take place unless the data values return below the threshold value and exceed the threshold again:

IMPORTANT NOTE: There's no need that an event that has just been created or edited is in a "Back to normal" state, which means that the next value that meets the condition will trigger the event.

Events can ONLY be triggered in an Active Event Window as depicted below. Activity Windows are described further in Step 11 later in this guide.

Has been inactive condition events will ONLY be triggered if the inactiveness is within the active window.

3. Creating a Conditional Event

image.png

Tip: In Ubidots conditional events engine you may select multiple devices and multiple variables within a single event or built complex events with triggers exist for multi-logic events (If {dev 1, varA} or {device 2, varB} are 100, then send SMS message)

Step1: Select Events (from the Data dropdown).
Step 2: Click on the add upper-right button.

image.png


Step 3: Select the If triggers tab to organize your event logic (If A,B, and/or C exists, then execute XYZ)

image.png

Step 4: Select a device, one device per conditional expression. Please note that multiple devices can be added using AND / OR conditionals.
Step 5: Select a variable, one variable per device can be selected at a time

Step 6: Establish event logic, you can choose either:

  • if the value is greater than

  • If the variable has not been updated

  • If the device position enters/exits in a Geofence

Step 7 : Select if the event variable value will be compared with a fixed value or with an Ubidots variable by choosing the Dynamic threshold option, be aware that dynamic thresholds are only available from industrial plan and above.

image.png

Step 8: Select the Then actions tab to execute the planed Event or Alert (SMS, Email, Telegram, Slack, and/or WebHook)

image.png

IMPORTANT NOTE SMS alerts support up to 140 characters. If exceeded, the message body will be trimmed to this length.

Step 9: Configure the event notice:

image.png

Pro Tip: Add specific data inputs into the event for immediate information.

  • Context

  • Device Label 

  • Device Name

  • Device Properties

  • Trigger Value ─ relative to the value which triggered the event

  • Trigger Timestamp – relative to the time at which triggered the event

  • Last Value ─ relative to the last value of the time series

  • Last Value's timestamp ─ relative to the timestamp of the last value

  • Variable

  • Variable Id

  • Variable Name

  • Variable Properties - learn more

  • Timestamp – relative to the current time

By default, data inputs involving timestamps are sent in human-readable format (YYY-MM-DD HH:mm:ss TZ). If you rather attach UNIX epoch time in milliseconds, double-click on the data input and delete the pipe symbol "|" forward.

Step 10: Repeat Events - Enable/Disable whether you prefer to get a notification every x minutes/hours/days up to x times while the event is triggered. Be aware that 50 is the max times the action will be executed.

image.png

IMPORTANT NOTE: Setting repetitive Event actions will also count as Event executions and may carry additional costs.

Step 11: Determine the activity window in which the events should be executed.

image.png

IMPORTANT NOTE: The activity window does not comprise hour ranges including day changes, meaning, it only works when the end time is greater than the initial, otherwise, the event cannot be created.

Step 12: Confirm your Events

4. Create a Back to Normal notification

After creating an Alert, it is inevitable that the event will be triggered at some point; one great feature of Ubidots Events Engine is the "Back to Normal" conditional notification. To activate a Back to Normal notification, simply follow the below three steps. 

image.png

Step 1: Select BACK TO NORMAL tab from the event's actions tab.
Step 2: Select the Trigger this action box to verify the desire to receive a back to normal notification.
Step 3: Add the custom notification message.

Step 4: Save.

5. Creating a Geofence notification

Geofencing is a software feature that, through GPS, defines geographical boundaries. When a device enters or exits a determined area, an alert (or event) can be triggered using Ubidots. To set a geofence notification, simply follow the below three steps. 

Step 1: Create a new event.
Step2: Choose a device and the associated variable that indicates the devices' "position".

Step3: Choose "Location" from the dropdown and determine when to trigger an event if upon entry or exit.

Step 4: Select "Add Geofence" and draw the boundary on the map that appears:

Polygon:

Circle:

Step 5: Continue the creation process as explained in the 3rd section of this guide.

6. Copying an existing event

At this point, you probably have set some events, some more complex than others but, what if you need to set an additional event using another device with the same conditional logic and same actions? There’s when"copy" event feature takes place. To do so, simply follow the below steps.

Step1: Search the existing event you want to copy.
Step2: From the right-side menu, choose the option "copy event".

Step3: Once done, you will get a new event named as "Copy-original event name" as depicted below.

NOTE: If the original event is linked to an organization, then, the new event will also be part of the same organization.

Step 4: Edit your new event as you see fit.

7. Results

Now it is your turn to build your very own conditional events with Ubidots. If you need a little help along the way, no problem, just message our team via email at support@ubidots.com or by the in-app chat channel with that little blue chat bubble in the bottom right of your App. 

Other users also found helpful:

Did this answer your question?