Explainer
Why MQTT tag metadata is not transmitted to MQTT Engine
Short answer
No: MQTT transports a topic and a payload, so engineering units, scaling, alarm definitions and history reach MQTT Engine only when the payload format represents them and the receiving mapping supports them. Carry metadata as companion tags or a documented schema, and edit a separate OPC tag layer rather than the generated Engine tags.

On this page
- Does MQTT carry tag metadata from Edge to Engine?
- Where does the metadata stop along the path?
- What does Sparkplug B actually put on the wire?
- Why does a plain JSON client create tags with no units or alarms?
- What does it cost to carry the metadata in the payload yourself?
- Can you edit the tags MQTT Engine creates?
- What should one test tag prove before you roll out?
- Questions asked
No. MQTT has no place to carry tag metadata: the protocol moves a topic string and a payload, and nothing else. Engineering units, scaling mode, alarm definitions and history configuration live in the publisher's tag database, and they appear on the MQTT Engine side only when the payload format encodes them and the Engine's mapping for that format turns them into tag properties. That is why a Sparkplug B publisher can deliver properties alongside values while a plain JSON publisher produces tags that update correctly yet carry no units and no alarms. This article follows each hop the metadata would have to survive, shows what the two payload styles put on the wire down to the byte, and gives the two workable paths when properties are missing: publish companion metadata tags beside the values, and make your edits on a separate OPC tag layer rather than on the generated tags.
Does MQTT carry tag metadata from Edge to Engine? #
No, MQTT 3.1.1 and 5.0 move only a topic and a payload; the protocol defines no field for engineering units, scaling mode, alarm limits or history configuration, so those properties can cross the broker only inside the payload, encoded by whatever format the publisher speaks.
MQTT is a publish and subscribe transport. The broker routes messages by topic, honors quality of service, and can store one retained message per topic; it never parses a payload to build tag properties, so a broker cannot drop metadata it never received. When a generated Engine tag shows a value with no unit and no alarm, the question is not what the broker lost but what the publisher encoded and what the receiver is specified to map. The Sparkplug specification exists because raw MQTT leaves that open: it layers a standard namespace and an encoded payload on top of MQTT, which is why it has become the default answer for this exact problem on the plant floor.
Where does the metadata stop along the path? #
The value survives every hop and the metadata stops at the first hop that does not encode it: the path is publisher tag store, publisher to broker, broker to Engine, Engine mapping, and only the first hop holds the configured properties.
| Hop | What crosses it | What survives |
|---|---|---|
| Publisher tag store | the configured value and its properties | units, scaling, alarm limits, history, all of it |
| Publisher to broker | one message: topic plus payload | only the fields the publisher encoded |
| Broker to Engine | the same message, routed unchanged | nothing added and nothing restored |
| Engine mapping | payload parsed into generated tags | only what the format and mapping define |
Subscribe an MQTT client to the topic at the broker and read one message as bytes. If the payload holds a tag name and a number and nothing else, the missing properties were never published and no Engine setting will create them; if the payload does carry metadata-shaped fields, compare them field by field with the generated tag, which separates a publishing problem from a mapping limitation on the receiver.
What does Sparkplug B actually put on the wire? #
Sparkplug B is the payload format built for this problem: it defines a standard namespace and an encoded payload in which the first message for a metric publishes its type, its alias and, for templates, its structure, so properties arrive in the same message as the value.
Any MQTT 3.1.1-compliant broker carries Sparkplug B payloads without needing to understand them, so the format choice costs nothing at the broker. The publish pattern is birth once, then data on change, which is why a metric's type and initial state ride in the first message; the reasoning is laid out in why Sparkplug B sends a birth certificate once and then data only on change. Structure travels the same way: a template definition describes the members of a UDT, and that definition is what becomes a type on the receiving side, as covered in how Sparkplug UDT definitions reach MQTT Engine. For the encoding itself, meaning how metrics are represented and how aliases stand in for names after the first message, the guide on decoding Sparkplug payloads and resolving aliases walks through it step by step.
Even here, keep the claim narrow: Sparkplug B carries type, alias and structure, and it does not turn the generated tag into a full copy of the publisher's tag. Which properties surface as native attributes on the Engine side depends on the deployed version, so test one metric, open the generated tag, and compare its property list against the documentation for your installed components. When properties do travel but still fail to appear on the tags, that is the distinct failure mode described in why MQTT Engine tags miss transmitted Sparkplug properties.
Why does a plain JSON client create tags with no units or alarms? #
Because JSON field names are not a mapping: the receiver treats every field of an undocumented payload as data, and it turns none of them into tag configuration unless its documentation says it will, which for arbitrary JSON it does not.
A tag that is created and keeps updating proves the transport works and proves nothing about mapping. There is no documented JSON structure that promotes arbitrary fields to tag properties, so a publisher searching for that structure is searching for something that does not exist. If you control both ends, define the schema yourself: name every field, declare its type, state the unit it carries, and document it where every integrator on the job can read it. Giving metadata an explicit home outside the transport is an established pattern; mapping PLC protocol metadata into a common database schema is the same idea applied one layer deeper, with the wire staying dumb and the schema carrying the meaning.
What does it cost to carry the metadata in the payload yourself? #
Each metadata field is ordinary payload bytes, and the arithmetic is small but real: an example value-only message of 33 bytes grows to 82 bytes when it also carries a unit string and two alarm limits, an increase of 49 bytes on every publish.
Take one example tag, a temperature input, with an example schema in which tag is a string, value a number, engUnit a string and the two alarm limits numbers. The two messages read:
{"tag":"TIC-101.PV","value":42.5} 33 bytes
{"tag":"TIC-101.PV","value":42.5,"engUnit":"degC","alarmHigh":50.0,"alarmLow":0.0} 82 bytes
Count the characters: the first line is 33 bytes, the second 82, so the three metadata fields add 49 bytes to each publish. At an illustrative report rate of one update per second, that is 49 x 3,600 = 176,400 bytes per hour for one tag, about 172 KiB; one hundred such tags publish 17,640,000 bytes per hour, about 16.8 MiB. On a plant LAN that is noise; over a cellular or radio link it competes with the process data, which is the same pressure addressed in shrinking a Sparkplug JSON payload on a narrow link.
The decision follows from the rate, not from the byte count alone: metadata changes rarely, so publish it once at startup and again only on change, never with every value update. Keep it on its own topic beside the value stream; publishing edge device tags as separate MQTT topics shows the topic-per-tag pattern. Publish the metadata topic with the retained flag set, so a subscriber that restarts receives the current metadata immediately instead of waiting for the next change.
Can you edit the tags MQTT Engine creates? #
Treat generated tags as read-only: the integration owns them and can regenerate them, so direct edits do not reliably survive; the dependable pattern is to expose the tag providers through the gateway's OPC-UA Server settings and edit OPC tags that read the generated ones.
- In the gateway configuration, expose the tag providers through the OPC-UA Server settings.
- Create OPC tags that read the generated Engine tags you need to configure.
- Make the unit, scaling and alarm edits on those OPC tags, which nothing regenerates.
- Point dashboards and client applications at the OPC tag layer, not the generated tags.
- Verify one tag end to end, including after an Engine restart, before standardizing the pattern.
This gives you a tag layer you own on top of the generated one, which is the point: the generated tags remain the transport's output, and your configuration lives where the integration cannot overwrite it. Verify the provider exposure and the tag paths on your installed versions, treat the pattern as an engineering decision to confirm per deployment, and do not present it as a documented guarantee.
What should one test tag prove before you roll out? #
One representative tag must survive the whole chain with its properties intact: capture the published payload at the broker, compare the generated Engine tag field by field, confirm each companion metadata value lands beside the right process tag, and only then replicate the pattern.
- Publisher side: record the Edge tag's property list before anything is published, so the comparison has a baseline.
- Broker: capture one message as bytes and list exactly which fields travel.
- Engine side: open the generated tag and compare its property list with the publisher baseline, field by field.
- Companion metadata: confirm every metadata value arrives and that the consumer's join logic attaches each one to the correct process tag.
- Edit layer: confirm an OPC tag reads the generated value and still holds your edits after an Engine restart.
A correct number on the screen verifies transport only. Carry the alarm question to the right place too: any limit that protects a person or a machine belongs in the controller or a safety-rated device, evaluated on the process value at the source, because SCADA alarm configuration is an operator layer and never the safety function. When every line of that list reads the same on a second site, the pattern is ready to copy; until then it is one tested tag, not a tested system.
Questions asked
What does the retained flag do for companion metadata?
When the metadata topic is published with the retained flag set, the broker stores that last message and hands it to every future subscriber immediately, including an Engine that restarts hours later. That is how metadata published once at startup still reaches a client that was offline when it was sent.
Do Sparkplug templates carry engineering units to MQTT Engine?
Templates carry structure: the members a UDT contains and their types, and that is what the Engine maps into type definitions. Whether an individual property such as an engineering-unit string becomes a native tag attribute depends on the receiving version, so verify on the installed Engine instead of assuming the template transported it.
Does MQTT 5.0 change the answer?
MQTT 5.0 adds user properties, key-value pairs that ride along with a message, so metadata can travel outside the payload. The receiving side still needs code that maps each pair to a tag property, and stacks built on MQTT 3.1.1, which is what Sparkplug deployments standardize on, never see them.
Can I batch metadata for many tags into one message?
Yes, as ordinary application data. One JSON message can carry an array with one object per tag, each holding its unit string and limits; publish it at startup and on change. The receiver still needs code that joins each record to its process tag by name, because nothing joins them automatically.
How should a JSON metadata schema be versioned?
Add a schema-version field to every payload and keep the schema document with the integration documentation. When a field is added, renamed or retyped, increment the version and make the receiver reject versions it does not recognize instead of silently accepting payloads whose meaning has changed.


