Tutorials / Rules Engine

Rules Engine

Create automated workflows and business logic for your IoT data

Overview

The Rules Engine enables you to create automated workflows based on device data and events. Build complex business logic without writing code using a visual rule chain designer.

Rule Chain Concepts

Rule chains consist of interconnected nodes that process data flow:

📥

Input Nodes

Trigger points that start rule execution (device data, schedules, external events)

⚙️

Processing Nodes

Transform, filter, or enrich data (scripts, transformations, calculations)

🔀

Logic Nodes

Conditional branching and decision making (filters, switches, conditions)

📤

Action Nodes

Execute actions (send commands, notifications, webhooks, database writes)

Creating a Rule Chain

1

Access Rules Engine

Navigate to the Rules section from the main menu.

2

Create New Rule Chain

Click the add button and provide a name and description for your rule chain.

3

Add Input Node

Drag an input node to the canvas. Configure the trigger (device data arrival, schedule, or external event).

4

Build Processing Logic

Add processing and logic nodes. Connect them to create your data flow. Configure each node's parameters.

5

Add Action Nodes

Connect action nodes to execute when conditions are met (send alerts, control devices, log data).

6

Test and Deploy

Use the test mode to validate rule behavior. Deploy the rule chain to activate it for production use.

Common Node Types

Node TypePurposeExample Use
FilterRoute data based on conditionsSeparate high/low temperature readings
ScriptCustom JavaScript processingCalculate moving averages or custom formulas
TransformModify message structureConvert units or format data
EnrichmentAdd contextual dataAttach device metadata or location info
RPCSend commands to devicesTurn relay on/off based on sensor value
NotificationSend alertsEmail/SMS when threshold exceeded

Example Rule Chains

Temperature Monitoring

Trigger: Temperature sensor data arrival

Logic: Filter temperature > 30°C

Actions:

  • Send email notification to maintenance team
  • Activate cooling system via RPC command
  • Log event to database

Predictive Maintenance

Trigger: Vibration sensor data every 5 minutes

Logic: Calculate moving average and detect anomalies

Actions:

  • Create maintenance ticket if anomaly detected
  • Update device status to "requires inspection"
  • Send webhook to CMMS system

Energy Management

Trigger: Schedule (every hour)

Logic: Aggregate power consumption across all devices

Actions:

  • Calculate total energy usage
  • Turn off non-critical devices if threshold exceeded
  • Post data to dashboard and external analytics platform

Advanced Features

  • Rule Chain Templates: Reusable patterns for common scenarios
  • Debugging Mode: Step through execution and inspect message flow
  • Version Control: Track changes and revert to previous versions
  • Performance Metrics: Monitor execution time and throughput
  • Error Handling: Configure fallback actions for failures
Pro Tip: Start with simple rule chains and gradually add complexity. Use descriptive node names and add comments to document your logic.