Skip to main content

MQTT

MQTT (Message Queuing Telemetry Transport) is a lightweight protocol designed for real-time messaging using a publish/subscribe model. OIBus acts as an MQTT client using the MQTT.js library to interact with MQTT brokers.

Specific Settings

Connection

SettingDescriptionExample Value
URLAddress of the MQTT broker (format: mqtt://address:port). Default port is 1883.mqtt://broker.example.com:1883
Reconnect periodTime (in milliseconds) to wait before reconnection attempts5000
Connect timeoutMaximum time (in milliseconds) to wait for connection establishment30000
Reject unauthorizedReject connections with unverified certificates (e.g., self-signed)Enabled/Disabled

Quality of Service

QoS LevelDescriptionExample Use Case
0At most once (no guarantee of delivery)Sensor data with high frequency updates
1At least once (guaranteed delivery, possible duplicates)Important notifications
2Exactly once (guaranteed single delivery)Critical commands
Persistence

QoS levels 1 and 2 support persistent connections, allowing the broker to retain messages for clients that reconnect after disconnection.

Authentication

No Authentication

SettingDescriptionExample Value
(None)No authentication required for connection-

Username / Password

SettingDescriptionExample Value
UsernameUsername for broker authenticationmqtt_user
PasswordPassword for broker authentication••••••••

Certificate Authentication

SettingDescriptionExample Value
Cert file pathPath to the signed certificate file/path/to/cert.pem
Key file pathPath to the private key file/path/to/key.pem
CA file pathPath to the certificate authority file. Leave empty for self-signed certs./path/to/ca.pem

Data Throttling

SettingDescriptionExample Value
Number of messages before flushNumber of messages to accumulate before flushing to North caches1000
Delay between flushTime delay (in milliseconds) between automatic flushes of accumulated messages1000

Item Settings

Topic Subscription

MQTT uses a hierarchical topic structure with wildcard support:

WildcardDescriptionExample
#Multi-level wildcardsensors/#
+Single-level wildcardsensors/+/temperature

Example Topic Structure:

  • root/
    • location1/
      • sensor1
      • sensor2
    • location2/
      • sensor1
      • sensor2

Payload Configuration

Basic Settings

SettingDescriptionExample Value
Payload in arrayWhether payload contains an array of valuesfalse
Point ID originSource of point ID (payload or oibus)payload
Timestamp originSource of timestamp (payload or oibus)payload

Value Extraction

SettingDescriptionExample Value
Value pathJSON path to the valuevalue
Point ID pathJSON path to point ID (required if from payload)pointId
Array pathJSON path to array (if payload is array)metrics

Timestamp Configuration

SettingDescriptionExample Value
Timestamp pathJSON path to timestamptimestamp
TypeTimestamp data typeISO8601
TimezoneTimezone for string timestampsUTC
Timestamp formatFormat for string timestampsyyyy-MM-dd HH:mm:ss

Payload Examples

Single Object

{
"pointId": "temperature1",
"value": 23.5,
"timestamp": "2023-01-01T12:00:00Z",
"quality": "good"
}

Array of Objects

{
"readings": [
{
"id": "temp1",
"value": 22.0,
"time": "2023-01-01T12:00:00Z"
}
]
}

Additional Fields

To add extra fields from payload:

SettingDescriptionExample Value
Output field nameName for additional fieldquality
Payload pathJSON path to field in payloadquality