In this article, you’ll learn how to trigger a Set variable action using Ubidots’ Events Engine.
Requirements
Table of Contents
Create a new Event.
Configure a Set variable action.
1. Create a new Event
To begin, create a new event from the "Events" section in the "Data" tab in your Ubidots Navbar.
Next, configure the Event logic using Ubidots’ “ANDs” / “ORs” operators. For additional details on how to configure conditional and complex Event triggers, check out the 3rd section of our Creating Conditional Events and Alerts user guide.
2. Configure the Set variable action
With the "If trigger" event logic configured, it is now time to create the Set variable action:
Step 1: Click on the upper-right add button
Step 2: Select the option Set variable
Step 3: Click on Select variable and search for:
Single Device
Device Group: Whenever the set variable action is triggered the data will be sent to the variable label of all Devices that make part of the chosen Device Group.
Triggered Device: Only available when a Global Event is configured. This option will send data to the variable label of a single device that makes part of the Device Group configured in the Global Event.
Step 4: Customize the “Active trigger” and the “Back to normal”(optional) messages. The following is a valid message that follows the Ubidots-compatible JSON format. Check out our API documentation to know more.{“value”:11.5, “timestamp“:1613665401000, ”context“:{”status“:”active“}}
NOTE: the “timestamp” and “context” keys are optional.
Step 5: Name the Event and Select the active days and hours.
Step 6: Save the event.