Rule Functions Overview
Rule functions leverage event-based triggers and customizable actions to create tailored logic for processing incoming data.
Creating a Rule Function
Select a device that you want to create a function for and navigate to the detail page. Click on the Functions
tab, then, click on the Create function
button.
Click on Get started
next to the Rule function
and choose a function template from the list.
Function options
Condition Configuration
Rule functions can be configured using one of two methods, each offering a different approach to condition configuration:
JavaScript Logic Builder
If you are comfortable with coding, the JavaScript Logic Builder allows the creation of custom logic using JavaScript syntax.
You can create conditions directly by using device data keys within the run()
function and data keys are inserted using the ${{KEY_NAME}}
format, where KEY_NAME
is the name of the data point you want to include.
function name run cannot be changed, and to trigger the condition, the internal function trigger(); must be called within the run function.
Example condition:
function run(){
let tmp = ${{TEMPERATURE}};
let hmdt = ${{HUMIDITY}};
let light = ${{LIGHT}};
let motion = ${{MOTION}};
let vdd = ${{VDD}};
// Your complex conditions go here
if (tmp > 25 && hmdt > 70) {
trigger();
}
}
Visual Condition Builder
The Visual Condition Builder provides quick and straightforward condition creation, using dropdown menus to specify parameters and desired conditions.
Start building today
Collect, process, and activate device data. Scale from one device to thousands.