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
| Protocol | Typical use |
|---|---|
| HTTP | Webhooks from SCADA systems, REST APIs, custom integrations |
| MQTT | IoT sensors, message brokers, lightweight communication |
| OPC UA | Industrial PLCs, control systems, industrial gateways |
Create an event source
Within the machine agent form, in the Event sources section:
- Click Add source.
- Complete the common fields and protocol-specific fields.
Common fields
| Field | Required | Description |
|---|---|---|
| Source ID | Yes | Unique identifier (e.g., plc-01). Cannot be changed after creation |
| Protocol | Yes | http, mqtt, or opcua |
| Enabled | No | Enables or disables event reception (default: enabled) |
| Throttle (seconds) | No | Minimum seconds between events from the same source (0-3600, default: 60) |
| Minimum severity | Yes | Filters events by minimum severity: info, warning, critical, emergency |
HTTP configuration (Webhook)
| Field | Description |
|---|---|
| Webhook URL | Automatically generated URL where your system sends events (read-only) |
| API Key | Automatically 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
| Field | Required | Description |
|---|---|---|
| Broker URL | Yes | MQTT broker address (e.g., mqtt://broker.local:1883) |
| Topic | Yes | MQTT topic to subscribe to (e.g., factory/line1/alarms) |
| QoS | No | Quality of service level: 0 (at most once), 1 (at least once), 2 (exactly once) |
| Username | No | Broker credentials |
| Password | No | Broker 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
| Field | Required | Description |
|---|---|---|
| Server URL | Yes | OPC UA server address (e.g., opc.tcp://192.168.1.10:4840) |
| Node ID | Yes | Identifier of the node to monitor (e.g., ns=2;s=AlarmNode) |
| Security policy | No | None or Basic256Sha256 |
| Username | No | Server credentials |
| Password | No | Server 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
| Gateway | HTTP | MQTT | OPC UA | Modbus | S7 |
|---|---|---|---|---|---|
| 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:
| Field | Description |
|---|---|
| Event type pattern | Regular expression to match event types (e.g., TEMP_.*) |
| Target agent | Agent that will process matching events |
| Priority | Rule 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:
- Open the agent detail.
- On the source card, click Send test event.
- The result shows success (green checkmark) or failure (red X).
Source status
Each source displays its current status with a visual indicator:
| Status | Color | Description |
|---|---|---|
| Connected | Green | Active connection receiving events |
| Connecting | Yellow (pulsing) | Attempting to connect |
| Error | Red | Connection error |
| Webhook | Blue | Waiting for incoming events (HTTP) |
Additionally shown:
- Event counter — Total events received.
- Last event — Timestamp of the most recent event.
Event severities
| Severity | Description |
|---|---|
| Info | Informational event, no action required |
| Warning | Warning that requires attention |
| Critical | Critical event requiring immediate action |
| Emergency | Emergency requiring urgent response |