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.
Embedded vs External Broker
Section titled “Embedded vs External Broker”Miravo starts an embedded aedes broker on port 1883. No external infrastructure required.
miravo start --template smart-factoryConnect to an existing MQTT broker:
miravo start --template smart-factory \ --mqtt-mode external \ --mqtt-url mqtt://broker.example.com:1883With authentication:
miravo start --template smart-factory \ --mqtt-mode external \ --mqtt-url mqtt://broker.example.com:1883 \ --mqtt-username user \ --mqtt-password passTopic Structure
Section titled “Topic Structure”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_feedbackMiravoWorks/smart-factory/production/line-1/centrifugal-pump-001/discharge_pressureMiravoWorks/smart-factory/utilities/compressed-air/air-compressor-001/header_pressurePayload Format
Section titled “Payload Format”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.
Configuration
Section titled “Configuration”| Option | Env Var | Default | Description |
|---|---|---|---|
--mqtt-port | MIRAVO_MQTT_PORT | 1883 | Broker port (0 = ephemeral) |
--mqtt-host | MIRAVO_MQTT_HOST | 127.0.0.1 | Broker bind host |
--mqtt-mode | MIRAVO_MQTT_MODE | embedded | embedded or external |
--mqtt-url | MIRAVO_MQTT_URL | — | External broker URL |
--mqtt-username | MIRAVO_MQTT_USERNAME | — | External broker username |
--mqtt-password | MIRAVO_MQTT_PASSWORD | — | External broker password |
--no-mqtt | — | — | Disable MQTT entirely |
Advanced Settings
Section titled “Advanced Settings”These can be set via environment variables:
| Env Var | Default | Description |
|---|---|---|
MIRAVO_MQTT_DRAIN_BUDGET | 16384 | Max messages per embedded drain cycle (512-65536) |
MIRAVO_MQTT_BATCH_SIZE | 2048 | Publishes before yielding to event loop (64-16384) |
MIRAVO_MQTT_BROKER_CONCURRENCY | 500 | Aedes internal concurrency (10-5000) |
Report by Exception (RBE)
Section titled “Report by Exception (RBE)”RBE filtering skips publishing when a value has not changed beyond a deadband threshold. Configure in template protocol settings or via the admin API.
Control Transport
Section titled “Control Transport”When MQTT is enabled, Miravo publishes control topics for monitoring:
| Topic | Content |
|---|---|
$miravo/<name>/metrics | Engine metrics (published every 5 ticks) |
$miravo/<name>/state | Engine state snapshot (published every 30 ticks) |
$miravo/<name>/cmd | Send engine commands as JSON |
$miravo/<name>/cmd/result | Command execution results |
Send commands over MQTT:
mosquitto_pub -t '$miravo/miravo/cmd' \ -m '{"type":"triggerFault","instanceId":"pump-001","fault":"cavitation"}'Disabling MQTT
Section titled “Disabling MQTT”Run with other protocols only (e.g., OPC UA):
miravo start --template smart-factory --no-mqtt --opcuaOr disable at runtime:
miravo adapter disable mqtt