Rela AIRela AI Docs
Machine Agents

Event sources

Configure HTTP, MQTT, and OPC UA event sources to monitor industrial machinery.

What is an event source

An event source is the connection between your industrial equipment and the machine agent. Each source receives data from a specific protocol and sends it to the agent for AI analysis.

Supported protocols

ProtocolTypical use
HTTPWebhooks from SCADA systems, REST APIs, custom integrations
MQTTIoT sensors, message brokers, lightweight communication
OPC UAIndustrial PLCs, control systems, industrial gateways

Create an event source

Within the machine agent form, in the Event sources section:

  1. Click Add source.
  2. Complete the common fields and protocol-specific fields.

Common fields

FieldRequiredDescription
Source IDYesUnique identifier (e.g., plc-01). Cannot be changed after creation
ProtocolYeshttp, mqtt, or opcua
EnabledNoEnables or disables event reception (default: enabled)
Throttle (seconds)NoMinimum seconds between events from the same source (0-3600, default: 60)
Minimum severityYesFilters events by minimum severity: info, warning, critical, emergency

HTTP configuration (Webhook)

FieldDescription
Webhook URLAutomatically generated URL where your system sends events (read-only)
API KeyAutomatically generated authentication key. Can be regenerated

To send events, your system must make a POST request to the webhook URL including the API Key in the headers.

Practical example: send an event with curl

curl -X POST https://api.relaai.com/api/v1/machine/events \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_SOURCE_API_KEY" \
  -d '{
    "source_id": "plc-bomba-c12",
    "event_type": "HIGH_VIBRATION",
    "severity": "critical",
    "message": "Vibration exceeds threshold: 8.2 mm/s",
    "metadata": {
      "vibration_mm_s": 8.2,
      "temperature_c": 72.5,
      "rpm": 1480
    }
  }'

Expected response: {"status": "processed", "event_id": "..."}

MQTT configuration

FieldRequiredDescription
Broker URLYesMQTT broker address (e.g., mqtt://broker.local:1883)
TopicYesMQTT topic to subscribe to (e.g., factory/line1/alarms)
QoSNoQuality of service level: 0 (at most once), 1 (at least once), 2 (exactly once)
UsernameNoBroker credentials
PasswordNoBroker credentials

Example: connect with mosquitto

mosquitto_pub -h broker.example.com -p 1883 \
  -t "plant/area-a/bomba-c12/vibration" \
  -u "rela_user" -P "secret" \
  -m '{"event_type":"VIBRATION","severity":"warning","message":"5.1 mm/s","metadata":{"value":5.1}}'

OPC UA configuration

FieldRequiredDescription
Server URLYesOPC UA server address (e.g., opc.tcp://192.168.1.10:4840)
Node IDYesIdentifier of the node to monitor (e.g., ns=2;s=AlarmNode)
Security policyNoNone or Basic256Sha256
UsernameNoServer credentials
PasswordNoServer credentials

Node ID formats

  • Numeric: ns=2;i=1001 (namespace 2, identifier 1001)
  • String: ns=2;s=Temperature.PV (namespace 2, string identifier)
  • GUID: ns=2;g=12345678-1234-...

Compatible industrial gateways

To connect equipment that does not support direct communication, you can use industrial gateways such as:

  • HMS Anybus
  • Siemens IOT2050
  • Moxa
  • Advantech

These gateways act as intermediaries between industrial protocols and HTTP/MQTT/OPC UA.

Gateway compatibility table

GatewayHTTPMQTTOPC UAModbusS7
HMS Anybus
Siemens IOT2050
Moxa ioThinx
Advantech WISE
Raspberry Pi (custom)✓*✓*

* Requires additional open-source libraries.

Routing rules

Each event source can have routing rules to direct events to different agents:

FieldDescription
Event type patternRegular expression to match event types (e.g., TEMP_.*)
Target agentAgent that will process matching events
PriorityRule evaluation order (lower = higher priority)

Rules are evaluated in priority order. The first matching pattern determines the agent that processes the event.

Test a source

In edit mode, you can send a test event to verify the connection:

  1. Open the agent detail.
  2. On the source card, click Send test event.
  3. The result shows success (green checkmark) or failure (red X).

Source status

Each source displays its current status with a visual indicator:

StatusColorDescription
ConnectedGreenActive connection receiving events
ConnectingYellow (pulsing)Attempting to connect
ErrorRedConnection error
WebhookBlueWaiting for incoming events (HTTP)

Additionally shown:

  • Event counter — Total events received.
  • Last event — Timestamp of the most recent event.

Event severities

SeverityDescription
InfoInformational event, no action required
WarningWarning that requires attention
CriticalCritical event requiring immediate action
EmergencyEmergency requiring urgent response

On this page