Appearance
Rule Engines (Developer)
Type rule_engine rows in rule_chains, bound via device_profiles.rule_engine_id. Optional tenant default_rule_engine_id (migration 0030) when the profile has no engine.
Ingest order
rule engine → persist / realtime / profile Alarm Rules
Data/attribute pipelines and calculated-fields stages are removed from the product path. Transforms belong in Rule Engine nodes.
API
GET/POST/PATCH/DELETE /api/rule-enginesPOST /api/rule-engines/:id/start|pausePOST /api/rule-engines/previewGET /api/rule-engines/:id/debug-tracesGET /api/rule-engines/:id/metrics- Tenant default: related fields on tenant / rule-engines APIs as exposed
Runtime
RuleEngineExecutorService.applyForDeviceon the ingest path- Filter supports compound
conditions+ optionaljson-rules-engineengineRules - Nodes:
delay,switch,notify,dedupe,math(+ - * /and abs, min, max, round, floor, ceil, sqrt, pow on numeric keys),rest_call,engine_ref,related_entity,integration_downlink, … - Message types:
telemetry,attributes,device_inactive,device_active,rpc_response - Webhook defaults to async (off critical path); set
async: falseto await - Debug traces + rolling metrics (
0029_rule_engine_debug.sql) - Script
metadata.messageTypeistelemetry,attributes,device_inactive,device_active, orrpc_response - Dedupe, throttle, create-alarm cooldown, and filter hysteresis are stored in Presence Redis (
ruleeng:state:) with a TTL when Redis is up, and also kept in process memory. If Redis is down, that state does not survive a restart or a second API process. Delay jobs already use Redis the same way. - Kill switch:
RULE_ENGINE_ENABLED
Messaging
MessagingServiceprefers Telegram (TELEGRAM_BOT_TOKEN); Brevo SMS optional fallback- Alarm tenant group:
tenants.telegram_chat_idviaPATCH /api/alarms/escalation-settings(telegramChatId) - Rule Engine
notifysupportsemails,phones,telegramChatIds
UI
- React Flow editor at
/rule-engines - Feature:
frontend/src/features/rule-engines - Dependency:
@xyflow/react, backendjson-rules-engine - Legacy
/data-pipelinesand/attribute-pipelinesredirect here
