When talking about automation is inevitable to think about tasks and actions to be performed based on time, but also that those tasks might be repetitive in a weekly basis. For instance, switching ON an irrigation system every day at 6 AM, and then switch it OFF at 7:30 AM; or something as simple as sending a reminder every Friday at 4 PM to a technician who’s responsible for a particular system that needs to be calibrated in order to guarantee its correct operation.
In this article, you will learn how to create Scheduled Events that will allow executing weekly alerts or actions, enabling your application to automate repetitive actions that should be triggered based on time.
– This article assumes that you already have basic knowledge about the Ubidots' Events engine. If not, we strongly recommend checking this article before, as some information may sound unfamiliar.
– This module is only available under an Ubidots paid license.
1. An Ubidots account (Professional and above)
Table of content
What exactly Scheduled Events are?
Setting the activation days and time.
Entering the input data.
Choose the actions to triggered.
1. What exactly Scheduled Events are?
In practical terms, Scheduled Events are actions triggered in a time weekly basis. Their main purpose is to send data, trigger alerts or execute processes using any of the Event’s built-in actions: Email, SMS, Telegram, Set Variable, Webhooks, etc.
In a single Scheduled Event, you can set multiple activation rows, each with its own activation schedule and input data, but sharing the same event actions. To that end, Scheduled Events use a JSON object as the input data for each activation row, hence, letting you send customized data and therefore triggering different behaviors in your application.
2. Setting the activation days and time.
1. First, go to the Events section tab under the Data tab. Once there, place your mouse over the upper-right add button, and click on the Scheduled Event button (The one with the clock icon).
2. Then, choose the days of the week in which the activation row will be triggered. You can select multiple days.
3. Next, click on the time option to open the time selector. Choose at what time the activation row should be triggered.
4. Select the timezone. By default, it’ll be set to the account’s default. If none configured, then it'll use the browser’s timezone.
3. Entering the input data.
As described in section 1, the input data is a JSON object that can later be accessed from the actions section, allowing you to send customized data based on each activation row. We recommend sending an Ubidots compatible JSON object, as it results familiar to the platform. For instance, in this example, we will send a value of “0” at 20:15 for deactivation when the workday is over, but a “1” at 04:30 AM for activation when a new workday starts:
1. Click on “Add input data”. A modal window will pop-up.
2. Enter the JSON object. In our example we will enter an Ubidots compatible object. You may copy and edit it as you see fit.
3. [Optional] In case you want to log the input data to an existing variable for control and debugging purposes, click on the down-arrow button to deploy more options. In case you want to use this option you must set an Ubidots compatible JSON, otherwise, your data won’t be logged:
A. Check the “Log input data to a variable” option to enable it.
B. Choose the variable to log the input data to. In our case, we chose a variable called “logs” in the “DG 1” Device.
PRO TIP: In case you’re still wondering, you can create multiple activation rows. Just press “Add Schedule” to add more.
4. Choose the actions to trigger.
Once you have set all the activation rows with their respective input data, press the next button to jump into the actions section.
1. Press the upper-right button to add a new action. Choose any action as you see fit for your application. In this example, we will select “Set variable” since this allows us to send the input value to the control variable that a machine is subscribed to and controls whether the machine should be turned ON or OFF.
2. In the action message, you can select from 2 bookmarks options:
Trigger Timestamp: Date and time at which the Event was triggered.
Input data: The value specified in the input data object.
PRO TIP: You can access the other keys of the input data object by double-clicking on the bookmark and entering the key you want to retrieve. For example,
5. Wrapping up
Once you have set the actions, click the next button to jump into the final section of the creation process. Give a name to your Scheduled Event.
Once the Scheduled Event has been successfully saved, it’ll trigger as set in the “If schedules” tab to activate/reactivate a machine, switch ON/OFF an irrigation system, or just sending a reminder to a technician, enhancing the experience and possibilities that you can already deploy with Ubidots.
Should you need assistance setting Scheduled Events, please reach out to us at firstname.lastname@example.org.
Other users also found helpful...