The MQTT configuration pages cover three levels: MQTT Clients, MQTT Devices, and MQTT Variables. Start by creating an MQTT client that defines the broker connection. Then create an MQTT device that groups variables under that client. Finally, create the MQTT variables that map publish and subscribe topics to named variables in the EnvisionSCADA namespace.
MQTT Clients handle the transport-level connection to the broker. MQTT Devices handle application-level grouping and topic structure. MQTT Variables define the individual payload mappings, data types, and historian behavior.
Keep client, device, and variable naming consistent with the broker topic structure so the overall MQTT layout remains easy to trace and maintain.
An MQTT device can also read a Sparkplug B edge node. With Protocol Sparkplug B, the device is one edge node of a Sparkplug B system, and its variables are the metrics of that edge node, without a topic per variable. The values, the data types, and the online state come from the birth and death certificates of the edge node. See Sparkplug B Devices.
Client Settings
Each MQTT client defines a connection to a single MQTT broker. Configure the broker endpoint, authentication, TLS options, and diagnostics.
Create a new client with the Add button in the toolbar. The Add dialog contains all client settings organized in the sections General, Connection, Sparkplug B, and Diagnostics, with default values already filled in. Enter at least the Name and Broker URL and press Create.
The client row shows Enable, Name, Broker URL, Port, Timeout, Retry, Username, Password, and Description directly and these values can be edited in place. Press the Settings icon on a client row to open the MQTT Client Settings dialog, which contains the same sections and all settings of the client. Press Save to apply the changes.
| Setting | Description | Example | Units / Format |
|---|---|---|---|
| Enable | Enables or disables the client connection to the broker. | true | Boolean |
| Name | Unique client name used to reference this broker connection from devices. | BrokerMain | Text |
| Broker URL | Hostname or IP address of the MQTT broker. | 192.168.1.100 | Text |
| Port | TCP port of the MQTT broker. | 1883 | Integer (1-65535) |
| Timeout | Connection timeout before a failed connection attempt is reported. | 6 | Seconds |
| Retry | Number of reconnection attempts before the connection is marked as failed. | 3 | Integer |
| Username | Username for broker authentication. Leave empty for anonymous access. | mqttuser | Text |
| Password | Password for broker authentication. | Text | |
| Description | Free text description for documentation purposes. | Main production broker | Text |
| Use TLS | Enables TLS encryption for the broker connection. | false | Boolean |
| Allow Untrusted Certificates | Bypasses certificate validation when TLS is active. | false | Boolean |
| Client Certificate Name | Subject name of the client certificate presented to the broker when Use TLS is switched on, looked up in the Windows certificate store under Local Computer / Personal. On Docker the certificate is read from the files in the /app/certs/tls folder: a .pfx or .p12 file without password, or a .crt, .pem or .cer file with its private key in the same file or in a .key file with the same name. Leave empty to connect without a client certificate. | envision01 | Text |
| Max Publish Queue Size | Maximum number of pending publishes buffered for this client while the broker is unreachable. The queue is drained as soon as the connection is restored. When the limit is reached the oldest entries are dropped and a system event is logged. | 50000 | Integer (1000-10000000) |
| Sparkplug Host ID | Host ID that this client announces as a Sparkplug Primary Host Application. The client publishes the retained STATE message online on spBv1.0/STATE/<Sparkplug Host ID> after every connect, and offline when it stops or loses its connection. Edge nodes that name this ID as their Primary Host ID publish only while this client is connected. With a Sparkplug Host ID, the client connects with the client id ENVISION-<Sparkplug Host ID>, for example ENVISION-EnvisionHost; without one, it uses a new client id at every start. Leave empty when this client is not a primary host. The characters +, /, and # are refused. | EnvisionHost | Text |
| Sparkplug Reorder Timeout | Time a missing sequence number of a Sparkplug B edge node may stay open before the edge node is asked for a Rebirth. | 2000 | ms (100-60000) |
| Verbose | Logging verbosity level. 0 is silent, higher values produce more diagnostic output. | 0 | Integer |
No rows match the filter.
Device Settings
Each MQTT device groups variables under one MQTT client. MQTT devices do not have their own broker connection; they inherit it from the client they belong to.
Create a new device with the Add button in the toolbar. The Add device dialog contains all device settings in the General section, with default values already filled in. Enter at least the Name and press Create.
The device row shows Enable, Name, Protocol, Template, Timeout, and Description directly and these values can be edited in place. Press the Settings icon on a device row to open the Edit device dialog, which contains the same settings. Press Save to apply the changes. With Protocol Sparkplug B, the Sparkplug B section with Group ID and Edge Node ID is shown, and Template and Timeout are hidden.
| Setting | Description | Example | Units / Format |
|---|---|---|---|
| Enable | Enables or disables communication for this device. | true | Boolean |
| Name | Unique device name used as a prefix for all variables on this device. | Sensor1 | Text |
| Template | Template device name. When set, all variables from the template are cloned to this device at startup. | MQTT_Template | Text |
| Timeout | Timeout applied to device-level communication operations. | 5000 | ms |
| Protocol | Topics: each variable reads its own Subscribe Topic. Sparkplug B: the device is one Sparkplug B edge node, and its variables are the metrics of that edge node. See Sparkplug B Devices. | Topics | Enum |
| Group ID | Sparkplug B only. Group ID of the edge node. Required with Protocol Sparkplug B. The characters +, /, and # are refused. | Site1 | Text |
| Edge Node ID | Sparkplug B only. Edge node ID of the edge node. Required with Protocol Sparkplug B. Group ID and Edge Node ID together must differ from every other Sparkplug B device of the same client. The characters +, /, and # are refused. | Gateway1 | Text |
| Description | Free text description for documentation purposes. | Temperature sensors line 1 | Text |
No rows match the filter.
Variable Settings
Each MQTT variable maps a publish or subscribe topic to a named variable in the EnvisionSCADA namespace.
Create a new variable with the Add button in the toolbar. The Add variable dialog organizes all variable settings in the tabs General, MQTT, Scaling, Historian, and Gateway, with default values already filled in. Enter at least the Name on the General tab and press Create. When the variable is created on a template device, it is also created on all instance devices that use the template. On a template device, start the Name with the {Device} replacer, so that each instance device gets its own variable. The Name must resolve to a different variable on each device; this is checked for every instance device before anything is saved, when a variable is created and when it is renamed.
The variable row shows Enable, Name, Asset, DataType, Publish Topic, Subscribe Topic, and Description directly and these values can be edited in place. Press the Settings icon on a variable row to open the Edit variable dialog, which contains the same tabs and all settings of the variable. Press Save to apply the changes. Changes made on a template device are also applied to the matching variable on all instance devices, while each instance keeps its own Modbus Address value. The Gateway tab settings Modbus Address, OPC UA, Writeable, MQTT Publisher, Kafka Device, Kafka Remap Device, and Kafka Remap Variable are also available as table columns, which are shown with Columns as described in the Configuration Tables article.
On a device with Protocol Sparkplug B, the dialog shows Sparkplug Device ID and Metric Name instead of Publish Topic and Subscribe Topic, the MQTT tab is hidden, and the table shows the columns Sparkplug Device ID and Metric Name instead of the topics. The Browse button lists the metrics of the edge node, see Browse Sparkplug Metrics.
| Setting | Description | Example | Units / Format |
|---|---|---|---|
| Enable | Enables or disables this variable. | true | Boolean |
| Name | Full variable name. The {Device}. replacer prefix is optional: {Device} resolves to the device name when the device loads, so the variable follows a device rename automatically, while a literal name is used exactly as written and keeps working across device renames. The resolved name must be unique across the whole project. | {Device}.Temperature | Text |
| Asset | Asset path for logical grouping. | Line1/Sensor1 | Text |
| DataType | Data type of the variable. | REAL | Enum |
| Publish Topic | MQTT topic to which this variable publishes its value. The {DeviceName} and {VariableName} replacers are substituted with the owning device name and the variable short name when publishing. | envision/line1/sensor1/temperature/set | Text |
| Subscribe Topic | MQTT topic from which this variable receives its value. The {DeviceName} and {VariableName} replacers are substituted with the owning device name and the variable short name when the subscription is created. | envision/line1/sensor1/temperature | Text |
| Sparkplug Device ID | Sparkplug B only. Sparkplug device the metric belongs to. Leave empty for a metric of the edge node itself. | Line1 | Text |
| Metric Name | Sparkplug B only. Name of the metric, exactly as the birth certificate of the edge node names it. A member of a Sparkplug template instance is named <instance>/<member>. Required on a device with Protocol Sparkplug B. | Pump1/Speed | Text |
| Description | Free text description for documentation. | Line 1 temperature | Text |
| User Groups | Comma-separated user groups allowed to write this variable from the runtime. | Operators,Engineers | Text |
| Signature Required | Requires an electronic signature for each write to this variable from a page object, the Live Manager, the Runtime API or MCP while Part 11 compliance mode is enabled and Write variables marked Signature Required is selected under Signature Required Actions on the Parameters page. The write rights of the user and the value range are checked first, so a refused write does not open the Electronic Signature dialog. A variable created while Part 11 compliance mode is enabled starts with Signature Required selected. Writes by alarm, event and schedule actions, Python scripts and the gateways run without a signature. See the Electronic Signatures article. | true | Boolean |
| Recipe Targets | Recipe type name (target) this variable belongs to. Supports the {Device} placeholder, which resolves to the owning device name so one naming rule can spread a set of variables across several devices. | Line1 | Text |
| Recipe Parameter Name | Explicit name of the parameter this variable represents inside a recipe. Variables that fill the same role across different targets share the same Recipe Parameter Name, which is how values are matched on Apply and Snapshot. A variable takes part in recipes only when both Recipe Targets and Recipe Parameter Name are set. | Setpoint | Text |
| Trend Groups | Trend groups this variable belongs to. | Sensor1TrendGroup1 | Text |
| Units | Engineering units displayed alongside the value. | °C | Text |
| Format | Display format of the value on screens and in the Trend Analyst: the value of a Label or Input (unless the object uses its own Floating Point and Decimals), the value text of a Knob and a Slider, the Trend tooltip, a Data Grid Variable column, the right-click menu, Quick Trend, the current value in the Recipe Manager, variable tokens in alarm and event messages, and the Trend Analyst tooltip, summary and pen Format. An Input shows the plain value while it is being edited. 0 shows no decimals, 0.00 always shows two decimals, 0.0## shows one to three decimals and #,##0.00 adds a thousands separator, with up to 15 decimals. Values are rounded half away from zero for display only; alarms and expressions keep the full value, and so does the historian unless Round to Format is on. ReadVariable in the runtime API and MCP returns the Format beside the full value. Leave empty to show the value as received. | 0.00 | Text |
| Min Raw | Minimum raw value for linear scaling. | 0 | Number |
| Max Raw | Maximum raw value for linear scaling. | 100 | Number |
| Min Scaled | Minimum scaled (engineering) value. | 0 | Number |
| Max Scaled | Maximum scaled (engineering) value. | 100 | Number |
| Converter | Converter name applied to the variable value. | Celsius_Fahrenheit | Text |
| Deadband | Minimum value change required before the historian records a new sample. | 0.5 | Number |
| Minimum Time | Minimum time between historian samples regardless of value change. | 1000 | ms |
| Sample Group | Sample group name for historian grouping. | Fast | Text |
| Historian | Enables historian logging for this variable. | true | Boolean |
| Round to Format | Stores the historian samples of this variable rounded to the decimals of its Format, as a plain number: with Format 0.00 the value 34.30487 is stored as 34.3. The deadband compares the rounded values, so with Deadband 0 a sample is written only when the rounded value changes. On a variable without scaling the Raw value is stored empty, since it equals the value. The live value, alarms, expressions and all interfaces keep the full value. Applies to new samples only; samples already stored keep their values. Requires a Format. | false | Boolean |
| History Source | Where the trends read the history of this variable: Project default (the History Source with Project default enabled on the History Sources page, or the EnvisionSCADA Historian when no source has it), EnvisionSCADA Historian (the samples recorded while Historian is on) or a History Source of the History Sources page (a query on a Database Connection or the fetch() function of a Python Module script). In the table, an empty History Source is Project default and Historian is the EnvisionSCADA Historian. Live values always come from the variable itself. Test reads the last 24 hours with the settings in the dialog. See the History Sources article. | Project default | Enum |
| History Reference | What the History Source reads for this variable: the reference passed to fetch(), or @Variable of the History Query. When empty, the History Reference of the source is used, by default the full name of the variable; the field shows it in italics. {Name} is replaced by the full name of the variable. Browse lists the references that a Script source offers. | CDT158 | Text |
| History Parameters | Shown for a Script source: optional key=value pairs separated by ;, added to the History Parameters of the source. A key set here replaces the same key of the source. The field shows the History Parameters of the source in italics. | scale=0.1 | Text |
| Identity In Message | Includes device and variable identity fields in the published MQTT payload. | false | Boolean |
| Timestamp Key | JSON key that holds the timestamp in the received (subscribed) payload, used to read the timestamp from an incoming message. The {VariableName} replacer is substituted with the variable name. | ts | Text |
| Value Key | JSON key that holds the value in the received (subscribed) payload, used to read the value from an incoming message. The {VariableName} replacer is substituted with the variable name. | value | Text |
| Publish Format | Template for the published payload. When set, it replaces the raw value. The {DeviceName}, {VariableName}, {TimeStamp}, and {VariableValue} replacers are substituted before publishing. When left empty, the variable value is published raw. | Text | |
| Modbus Address | Optional address on the built-in Modbus TCP and Modbus RTU servers where this variable is exposed. The servers are enabled in the Gateways section of the Parameters page. Each instance device keeps its own value. | %MW0 | See Modbus TCP Addressing |
| OPC UA | Exposes this variable on the built-in OPC UA server. When Historize is also ticked, the Historian data of the variable is readable through OPC UA Historical Access. | true | Boolean |
| Writeable | Allows external systems to write this variable through the gateways: the OPC UA Server, the Modbus TCP and Modbus RTU servers, the MQTT publisher when Subscribe is enabled on the publisher, and Kafka when Consumer is enabled on the Kafka device. Writes from pages, actions, scripts and the API are independent of this setting. | true | Boolean |
| MQTT Publisher | Name of the MQTT publisher that publishes this variable, typed or chosen with the ... button. A variable is published by one publisher, and the name must match a publisher on the MQTT Publishers page. The publisher uses its own broker connection, separate from the MQTT device of this variable. Leave empty to keep the variable unpublished. Writes from the broker need Subscribe on the publisher and Writeable on the variable. See the MQTT Publishers article. | CloudIoT | Text |
| Kafka Device | Name of the Kafka device this variable is linked to, typed or chosen with the ... button. Every value change of a linked variable is produced to the Producer Topic of the Kafka device while the device is enabled. Writes from the Consumer Topic need Consumer on the Kafka device and Writeable on the variable. Leave empty to keep the variable unlinked. See the Kafka Devices article. | KafkaBroker1 | Text |
| Kafka Remap Device | Device name used for this variable in Kafka messages instead of the name of the device that owns the variable. Inbound messages from the Consumer Topic are matched on this name as well. Leave empty to use the device name. | RemotePLC1 | Text |
| Kafka Remap Variable | Variable name used for this variable in Kafka messages instead of its own name. Inbound messages from the Consumer Topic are matched on this name as well. Leave empty to use the variable name without the device name, for example Temperature for Sensor1.Temperature on device Sensor1. | Temperature | Text |
No rows match the filter.
Sparkplug B Devices
A device with Protocol Sparkplug B reads one edge node of a Sparkplug B system, as defined by the Eclipse Sparkplug 3.0 specification. The client subscribes to the Sparkplug namespace spBv1.0/# and acts as a Sparkplug host application for the edge nodes of its Sparkplug B devices. Messages of other edge nodes are ignored. The client handles the messages as follows:
- The birth certificates NBIRTH and DBIRTH define the metrics of a session, with name, alias, data type, and the first value. The variables receive their values from the birth certificate, and the device shows Online.
- NDATA and DDATA carry changed values, by alias or by name. Historical metrics (is_historical) do not change the live value.
- An NDEATH with the bdSeq of the current session, or the loss of the broker connection, sets every variable of the device to ConnectionLost and the device to Offline. An NDEATH of an older session is ignored. A DDEATH sets the variables of that Sparkplug device to ConnectionLost.
- After every connect, the client asks every enabled edge node for a Rebirth (NCMD Node Control/Rebirth). With Sparkplug Host ID set, it waits 2 seconds first, because edge nodes that use this client as primary host publish their birth certificates by themselves.
- A missing sequence number that stays open longer than Sparkplug Reorder Timeout, data from an edge node without a birth certificate in the current session, and an unknown alias each lead to a Rebirth request, at most one per edge node every 5 seconds.
- A Sparkplug template instance is read as its members, named <instance>/<member>. Arrays are shown as text in JSON array notation, and DateTime metrics as ISO 8601 text in UTC.
- A configured metric that is missing from the birth certificate sets its variable to ConnectionLost and is logged in the System Log.
Values are written to the variables with the time stamp of the metric, after the Scaling and the Converter of the variable. The data types of Sparkplug B are shown as follows; Browse sets the matching Data Type when it adds a variable:
| Sparkplug data type | Data Type |
|---|---|
| Boolean | BOOL |
| Int8, Int16 | INT |
| Int32 | DINT |
| Int64 | LINT |
| UInt8 | BYTE |
| UInt16 | UINT |
| UInt32 | UDINT |
| UInt64 | ULINT |
| Float | REAL |
| Double | LREAL |
| String, Text, UUID, DateTime, arrays | STRING |
No rows match the filter.
The Quality property of a metric sets the status of the variable. A metric without the property is Good. A null value sets the status Unknown, or the status of its quality when that is not GOOD.
| Quality | Status |
|---|---|
| 192 (GOOD) | Good |
| 500 (STALE) | Timeout |
| 0 (BAD) and other values | ConnectionLost |
No rows match the filter.
Writes. A write to a variable of a Sparkplug B device, from a page, an action, a script, or the API, is sent to the edge node as an NCMD command for an edge node metric or a DCMD command for a device metric, with the alias and the data type of the birth certificate. A write is refused and logged while the edge node or the Sparkplug device has no birth certificate in the current session. A metric that is not in the birth certificate, for example Device Control/Rebirth, is sent by name with the Data Type of the variable. Commands are not queued, so a write is never applied late.
Sparkplug Host ID. When Sparkplug Host ID is set on the client, the client is a Sparkplug Primary Host Application. Edge nodes that name it as their Primary Host ID publish their birth certificates when the client reports online, and end their session when the client stops. A change of the client, its devices, or its variables restarts the client, so these edge nodes publish their birth certificates again.
Redundancy. MQTT clients run on the primary node only. On a failover, the new primary node connects, publishes the STATE online when Sparkplug Host ID is set, and asks every edge node for a Rebirth. Both nodes need the same time base (NTP), because edge nodes compare the time stamps of the STATE messages.
Browse Sparkplug Metrics
On a device with Protocol Sparkplug B, the Browse button of the MQTT Variables page opens the Browse Sparkplug Metrics dialog. It shows the Group ID, the Edge Node ID, and whether the edge node is Online, and lists the metrics of the last birth certificates of the edge node with Device ID, Metric Name, Data Type, and Value. Metrics that are already configured on the device are marked Configured. Before the first birth certificate, the list is empty; press Request Rebirth to ask the edge node for its birth certificates. The list is loaded again after 1.5 seconds.
Select metrics and press Add Selected to create one variable per metric. The variable name is the metric name with every slash replaced by a dot and every other character that a variable name cannot contain replaced by an underscore. With Start names with {Device}. ticked, the name starts with the {Device} replacer. The Data Type follows the table in Sparkplug B Devices. Metrics whose name cannot be used are skipped, and the dialog shows how many variables were added and skipped.
Supported Data Types
The Data Type field determines how the MQTT payload value is interpreted.
| Type | Description |
|---|---|
| BOOL | Single bit value (true/false). |
| BYTE | Unsigned 8-bit integer. |
| INT | Signed 16-bit integer. |
| UINT | Unsigned 16-bit integer. |
| WORD | Unsigned 16-bit word. |
| DINT | Signed 32-bit integer. |
| UDINT | Unsigned 32-bit integer. |
| DWORD | Unsigned 32-bit word. |
| REAL | 32-bit IEEE 754 floating point. |
| LINT | Signed 64-bit integer. |
| ULINT | Unsigned 64-bit integer. |
| LREAL | 64-bit IEEE 754 floating point. |
| STRING | Character string. |
No rows match the filter.
Notes
The channel state indicator on each client and device row shows the current connection status. For a Sparkplug B device, the channel state is Online while the edge node has a birth certificate in the current session, and Offline after its death certificate or while the client is disconnected.
A variable can have a Publish Topic, a Subscribe Topic, or both. When a Subscribe Topic is set, the variable value is updated whenever a message arrives on that topic. When a Publish Topic is set, the variable value is sent to that topic whenever it changes.
When Identity In Message is enabled, the published JSON payload includes a device and variable identifier alongside the value. Use Timestamp Key and Value Key to control the exact JSON field names when the receiving system requires a specific message schema.
Variables are referenced at runtime using the format DeviceName.VariableName, for example Sensor1.Temperature.