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
Access Rules Engine
Navigate to the Rules section from the main menu.
Create New Rule Chain
Click the add button and provide a name and description for your rule chain.
Add Input Node
Drag an input node to the canvas. Configure the trigger (device data arrival, schedule, or external event).
Build Processing Logic
Add processing and logic nodes. Connect them to create your data flow. Configure each node's parameters.
Add Action Nodes
Connect action nodes to execute when conditions are met (send alerts, control devices, log data).
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 Type | Purpose | Example Use |
|---|---|---|
| Filter | Route data based on conditions | Separate high/low temperature readings |
| Script | Custom JavaScript processing | Calculate moving averages or custom formulas |
| Transform | Modify message structure | Convert units or format data |
| Enrichment | Add contextual data | Attach device metadata or location info |
| RPC | Send commands to devices | Turn relay on/off based on sensor value |
| Notification | Send alerts | Email/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