Proxus uses a powerful Criteria Language to evaluate rules against incoming data. The rule engine supports four event types:
- DataReceived (
TransportData) - Device telemetry and sensor data - StatusChanged (
DeviceStatus) - Device connection status changes - LogReceived (
Log) - System log messages for monitoring and alerting - MetricsReceived (
ProxusActorMetrics) - Actor performance metrics
Each event type evaluates criteria against a different data model.
Prefer a graphical interface? See the Visual Rule Editor.
Data Access Syntax
The rule engine evaluates conditions against collections of data. You use the bracket [...] syntax to filter these collections.
| Collection | Description | Access Pattern |
|---|---|---|
| Payload | List of metrics (e.g., Temperature, Voltage). | [Payload][Key = 'Temp' AND NumericValue > 50] |
| MetaData | List of device metadata (e.g., DeviceId). | [MetaData][Key = 'Location' AND Value = 'Zone1'] |
| Attributes | Dictionary of extra attributes. | [Attributes][Key = 'Priority' AND Value = 'High'] |
| Topic | The message topic (String). | [Topic] = 'Device123' |
Important: Bracket Logic
When you place multiple conditions inside a single bracket block, they must apply to the same item in the collection.
- Correct:
[Payload][Key = 'Temp' AND NumericValue > 50] - (Find an item where Key is 'Temp' AND its Value is > 50)
- Incorrect:
[Payload][Key = 'Temp'] AND [Payload][NumericValue > 50] - (Find an item where Key is 'Temp', AND find ANY item where Value is > 50. These might be different items!)
Operators & Functions
Comparison & Logic
| Operator | Description | Example |
|---|---|---|
=, !=, <> | Equality | [Topic] = 'Gen1' |
>, >=, <, <= | Numeric Comparison | NumericValue > 100 |
AND, OR, NOT | Logical Operators | Condition1 AND NOT Condition2 |
[v] BETWEEN(min, max) | Range Check | NumericValue BETWEEN(10, 20) |
[v] IN(list) | List Check | Value IN ('A', 'B', 'C') |
String Functions
| Function | Description | Example |
|---|---|---|
Contains(str, substr) | Checks for substring. | Contains(Value, 'Error') |
StartsWith(str, prefix) | Checks prefix. | StartsWith(Value, 'Sensor') |
EndsWith(str, suffix) | Checks suffix. | EndsWith(Value, '.log') |
Len(str) | String length. | Len(Value) > 5 |
Upper(str), Lower(str) | Case conversion. | Upper(Value) = 'OK' |
Replace(str, old, new) | Replace text. | Replace(Value, '-', '') |
Date & Time Functions
| Function | Description | Example |
|---|---|---|
Now() | Current server time. | Time > AddMinutes(Now(), -5) |
AddMinutes(date, n) | Add/Subtract minutes. | Time < AddMinutes(PreviousValueTime, 10) |
AddHours(date, n) | Add/Subtract hours. | Time >= AddHours(Now(), -1) |
AddDays(date, n) | Add/Subtract days. | Time >= AddDays(Now(), -1) |
GetYear(date) | Extract year. | GetYear(Time) = 2024 |
Utility Functions
| Function | Description | Example |
|---|---|---|
Iif(cond, true, false) | Inline If. | Iif(NumericValue > 10, 'High', 'Low') |
IsNullOrEmpty(str) | Check for null/empty. | IsNullOrEmpty(Value) |
ToDouble(str) | Convert string to number. | ToDouble(Value) > 5.5 |
Abs(n) | Absolute value. | Abs(NumericValue) > 10 |
Common Scenarios
1. Simple Threshold
Trigger if the "Temperature" tag is above 80.
[Payload][Key = 'Temperature' AND NumericValue > 80]2. Device & Value Filter
Trigger if "Pressure" is low AND it comes from a specific device.
[MetaData][Key = 'DeviceName' AND Value = 'Pump01']
AND
[Payload][Key = 'Pressure' AND NumericValue < 10]3. Change Detection (Delta)
Trigger if "Speed" changed by more than 5 units compared to the previous value.
[Payload][Key = 'Speed' AND Abs(NumericValue - ToDouble(PreviousValue)) > 5]4. Deadband / Range
Trigger if "Voltage" is outside the safe range (220-240).
[Payload][Key = 'Voltage' AND NOT (NumericValue BETWEEN(220, 240))]5. Time Gap (Stale Data)
Trigger if the new value arrived more than 10 minutes after the previous one.
[Payload][Key = 'Heartbeat' AND Time >= AddMinutes(PreviousValueTime, 10)]Device Status Rules
When the Rule Event is set to Status Changed, criteria are evaluated against the DeviceStatus object (not TransportData).
| Property | Description |
|---|---|
| DeviceId | Unique ID of the device. |
| DeviceName | Name of the device. |
| CurrentConnectionStatus | Connected or Disconnected. |
| PreviousConnectionStatus | Connected or Disconnected. |
| ConnectionDuration | Duration in seconds in the current state (Double). |
Example: Device Disconnected
CurrentConnectionStatus = 'Disconnected'Log-Based Rules
When the Rule Event is set to Log Received, criteria are evaluated against the Log object. This allows you to monitor system logs and trigger alerts based on specific log patterns.
| Property | Description |
|---|---|
| Message | The log message content (String). |
| Level | Log severity: Trace, Debug, Information, Warning, Error, Critical. |
| Category | Log category/source (e.g., Proxus.ProtocolDrivers or Proxus.SystemCore). |
| Source | Log source identifier. |
| Time | Timestamp of the log entry (DateTime). |
CRITICAL: Log rules can trigger actions (like notifications) that themselves generate logs. To prevent infinite loops:
- Use strict criteria (specific categories, levels, or message patterns)
- Apply rate limiting (e.g., max 10 actions per 60 seconds)
- Avoid overly broad criteria like
Level = 'Error'
The platform automatically filters out rule engine logs to prevent self-triggering.
Example 1: Critical Errors
Level = 'Critical' OR Level = 'Error'Metrics-Based Rules
When the Rule Event is set to Metrics Received, criteria are evaluated against the ProxusActorMetrics object. This enables monitoring of actor performance and data quality metrics.
| Property | Description |
|---|---|
| Device | Device or service identifier (String). |
| TotalRequests | Total number of requests processed (Int64). |
| SuccessfulRequests | Number of successful requests (Int64). |
| FailedRequests | Number of failed requests (Int64). |
| TotalDataReceived | Total data packets received (Int64). |
| AverageResponseTime | Average response time in milliseconds (Double). |
| ResponseCount | Total valid responses received (Int64). |
| ProcessedDataCount | Total unique data points processed (Int64). |
| ReadErrorCount | Number of protocol read errors (Int64). |
| ReadErrorPercentage | Percentage of requests that failed (0-100). |
| DataAccuracy | Data quality metric: accuracy percentage (0-100). |
| DataCompleteness | Data quality metric: completeness percentage (0-100). |
| DataFreshness | Data quality metric: freshness percentage (0-100). |
| DataIntegrity | Data quality metric: integrity percentage (0-100). |
| DataConsistency | Data quality metric: consistency percentage (0-100). |
| ConnectionErrorCount | Number of connection errors (Int64). |
| SleepModeTransitionCount | Number of times device entered sleep mode (Int64). |
| LastCommunicationTime | Last communication timestamp (DateTime). |
| LastDataReceivedTime | Last valid data packet timestamp (DateTime). |
Metrics rules are ideal for:
- Monitoring service health and performance
- Detecting degraded service quality
- Alerting on high error rates
- Tracking data quality trends
Recommended Rate Limiting: Max 5 actions per 300 seconds (5 minutes)
Anomaly Detection
For statistical analysis over a sliding window (e.g., Z-Score, Moving Average), select the Anomaly Detection mode in the Rules Engine.
In Anomaly Detection mode, you can still use Criteria Expressions to act as a pre-filter. Only data matching the criteria will be fed into the statistical model (e.g., [Payload][Key='Vibration']).