Skip to content

MQTT

Connect to MQTT with Miravo's embedded broker or an external one. Configure UNS topics, payload format, control transport, and report-by-exception filtering.

Miravo publishes every asset member as an individual MQTT topic. MQTT is enabled by default.

Miravo starts an embedded aedes broker on port 1883. No external infrastructure required.

Terminal window
miravo start --template smart-factory

Topics follow the Unified Namespace (UNS) pattern derived from the template’s namespace and browse paths:

{enterprise}/{site}/{area}/{line}/{instance}/{member}

Example topics from the smart-factory template:

MiravoWorks/smart-factory/production/line-1/belt-conveyor-001/speed_feedback
MiravoWorks/smart-factory/production/line-1/centrifugal-pump-001/discharge_pressure
MiravoWorks/smart-factory/utilities/compressed-air/air-compressor-001/header_pressure

Each message is a JSON object:

{
"value": 5.21,
"timestamp": 1710000000000,
"quality": "good",
"unit": "bar",
"instanceId": "centrifugal-pump-001",
"model": "centrifugal-pump",
"dataType": "Double"
}

With metadata: "full", additional fields are included: access, euRange, kind.

OptionEnv VarDefaultDescription
--mqtt-portMIRAVO_MQTT_PORT1883Broker port (0 = ephemeral)
--mqtt-hostMIRAVO_MQTT_HOST127.0.0.1Broker bind host
--mqtt-modeMIRAVO_MQTT_MODEembeddedembedded or external
--mqtt-urlMIRAVO_MQTT_URLExternal broker URL
--mqtt-usernameMIRAVO_MQTT_USERNAMEExternal broker username
--mqtt-passwordMIRAVO_MQTT_PASSWORDExternal broker password
--no-mqttDisable MQTT entirely

These can be set via environment variables:

Env VarDefaultDescription
MIRAVO_MQTT_DRAIN_BUDGET16384Max messages per embedded drain cycle (512-65536)
MIRAVO_MQTT_BATCH_SIZE2048Publishes before yielding to event loop (64-16384)
MIRAVO_MQTT_BROKER_CONCURRENCY500Aedes internal concurrency (10-5000)

RBE filtering skips publishing when a value has not changed beyond a deadband threshold. Configure in template protocol settings or via the admin API.

When MQTT is enabled, Miravo publishes control topics for monitoring:

TopicContent
$miravo/<name>/metricsEngine metrics (published every 5 ticks)
$miravo/<name>/stateEngine state snapshot (published every 30 ticks)
$miravo/<name>/cmdSend engine commands as JSON
$miravo/<name>/cmd/resultCommand execution results

Send commands over MQTT:

Terminal window
mosquitto_pub -t '$miravo/miravo/cmd' \
-m '{"type":"triggerFault","instanceId":"pump-001","fault":"cavitation"}'

Run with other protocols only (e.g., OPC UA):

Terminal window
miravo start --template smart-factory --no-mqtt --opcua

Or disable at runtime:

Terminal window
miravo adapter disable mqtt