Troubleshooting
Why MQTT sensor data is missing in OPC UA on a ctrlX CORE
Short answer
MQTT reception and OPC UA exposure are separate layers: a subscription never creates a variable. Run a Data Layer provider app that registers one node per measurement, point Node-RED's Data Layer write at each registered address, and the ctrlX OPC UA server then exposes those nodes to clients.

On this page
Your Node-RED flow on the ctrlX CORE subscribes to the sensor's topics on the MQTT broker, the dashboard updates on every publication, and then the OPC UA client finds nothing: the value exists in no address space. That is expected behavior, not a broker or client fault. An MQTT subscription delivers messages; OPC UA, standardized as IEC 62541, serves a typed address space that exists only where a provider creates and serves one, and on a ctrlX CORE that provider is a Data Layer app. The fix runs in this order: deploy a Data Layer provider - the Python provider samples in the ctrlX Automation SDK are the documented starting point - let it register one node per measurement, decode the payload in Node-RED, and write each value to its registered address. The ctrlX OPC UA server then exposes those nodes to clients, and the checks below run in that order.
Where the data path stops #
Trace the path in operating order and give each hop its own proof:
- Sensor to broker: the device publishes on its topic; the proof is a new message arriving at the broker.
- Broker to Node-RED: the subscription delivers; the proof is the message in the debug panel. Reception faults live here - Fix MQTT sensor data missing in Node-RED covers that side of the flow.
- Node-RED to Data Layer: a write to a node that a provider has registered. In this fault the hop does not exist yet, because nothing has registered the destination.
- Data Layer to OPC UA client: the ctrlX OPC UA server serves the registered nodes; the proof is a browse that finds the address and a read that returns the current value.
A live dashboard proves hops one and two only, at that moment, and says nothing about hops three and four - which is exactly where this fault lives. If you meant Node-RED to serve its own OPC UA address space, that is a different architecture, and Why a Node-RED MQTT to OPC UA variable never appears handles that design. While tracing, record the host and port each application actually uses; MQTT listeners default to 1883 or 8883 and OPC UA endpoints to 4840, but a deployment can move any of them, so test against the configured values rather than the defaults.
Register the nodes with a Data Layer provider app #
The missing hop is a provider application. Registration is what creates the addressable, typed interface: the Provider class of the ctrlX Data Layer API for Python takes the node address you supply - the documentation allows wildcards in that address - and registers the node with the Data Layer. In the SDK's Python provider samples such as datalayer.provider.sub, the provider.py module manages the Data Layer connection and the creation of the node, and the documented ProviderNode and ProviderNodeCallbacks interfaces are what answer reads and writes from other apps.
You own the address layout. Define one stable address per measurement - for example my-mqtt-bridge/line1/temperature, an illustrative layout of your own - declare its data type, and decide what an unwritten node returns before the first publication arrives, because OPC UA clients will read it in that state.
Deploy the provider as a ctrlX app using the SDK's packaging workflow; a script running on a development PC is not a provider on the CORE. Keep the process alive: the registration belongs to the running provider, so when it stops, its nodes and the OPC UA variables built on them disappear with it.
Verify the hop before connecting any MQTT traffic. Write a known test value through a Data Layer client, read it back, and require the same value and the same type. Direct Data Layer reads need no OPC UA at all: Read a node and all subnodes in Node-RED from the Data Layer shows the browse-and-read flow, and reading ctrlX CORE variables without an OPC UA server goes deeper on that access path.
Decode the payload before the write #
Inspect one message at the subscription output before wiring anything to a write. Establish whether the payload is a numeric string, a structured object or binary; select the field you want; and convert it to the destination node's declared type. A dashboard happily displays text that a typed Data Layer node rejects, and a structured payload can carry several measurements when the visualization needs one. For an example payload {"ts_ms": 1721218025123, "temp_c": 42.5, "status": 0}, the bridge writes the number 42.5 from temp_c into the temperature node - never the whole object into a scalar. Reject malformed input at the decode step instead of letting a failed write surface downstream as a stale value.
Worked example: stamp from the payload, not from reception #
Node-RED receives the example payload when its own clock reads 1721218025127 ms; the payload's ts_ms field says 1721218025123 ms. The transport took 1721218025127 - 1721218025123 = 4 ms, negligible for a live value. Now suppose the broker holds the message as retained and delivers the same payload again 30 s later, when reception time reads 1721218055127 ms. Stamping by reception places the measurement 1721218055127 - 1721218025123 = 30,004 ms after it was taken: half a minute of error on a value that looks fresh. Write the payload timestamp into a node whenever the sensor provides one; fall back to reception time only when it does not, and mark it as reception time so no historian or report treats it as measurement time.
Point Node-RED at the registered node #
The ctrlX automation nodes for Node-RED read from and write to the ctrlX Data Layer, and per their documentation they run in the Node-RED app on the ctrlX CORE itself or in Node-RED on another host - an industrial mini PC in the same cabinet, for example, when you want flow processing off the CORE. Whichever host runs the flow, the writer needs network reachability to the Data Layer and an identity with write permission.
Configure each write against four things:
- Destination address: the registered address, character for character. A one-segment difference reads as a missing node at write time.
- Value type: the decoded value must match the node's declared type, or the write is rejected.
- Write identity: a user or token with update rights on that node. A node that browses is not automatically a node that accepts writes.
- Update rate: decide what happens when publications arrive faster than writes complete. A dashboard needs only the newest value, so write latest and discard; a logging task needs every sample, which means queuing in the flow and checking that the queue drains.
Watch write completion, not reception. The signature of this fault half-fixed is a dashboard that updates while a direct Data Layer read of the destination returns the same old value.
Verify the variable in the OPC UA address space #
Registration and OPC UA exposure are separate checks, so run the second one on its own. With the provider running, browse the ctrlX OPC UA server's address space from the client and find the registered address; then trigger a real sensor change and read through the client. If the example payload's temperature moves from 42.5 to its next reading, say 43.1, the client read must return 43.1 within one publication interval - not after a manual refresh, and not as the previous value.
If the browse finds nothing while the direct Data Layer read works, the causes in order of likelihood are: the provider process has stopped and its registration ended with it; the client is pointed at the wrong endpoint or failing security negotiation; or the client is browsing a different server than the one exposing the Data Layer.
The decision, case by case #
- Dashboard live, nothing in OPC UA: no provider has registered the nodes. Deploy a Python provider from the SDK samples, register one typed node per measurement, and wire the decoded writes. No broker, firewall or client setting creates the variable for you.
- Node browses, write fails: address or type mismatch, or a read-only identity. Match the registered address exactly, match the declared type, and write with an identity that has update rights.
- Write succeeds, client still sees nothing or an old value: check first that the provider process is still running, then the client's endpoint and security configuration.
- Values read back but timestamps jump after a reconnect: retained deliveries are being stamped by reception time; stamp from the payload timestamp instead.
One line of scope: this bridge is a monitoring and visualization path - MQTT, Node-RED and OPC UA carry no safety rating, so keep it out of any safety function.
Questions asked
Can Node-RED expose the values through its own OPC UA server instead?
Yes, and it is a different architecture. An OPC UA server node inside the flow exposes its own address space to clients, separate from the ctrlX OPC UA server and the Data Layer. The trade-off is that the values live only inside the flow: Data Layer clients and other apps cannot read them, and the whole address space disappears when Node-RED stops. On a ctrlX CORE, the provider route keeps the data in the system's Data Layer, where every runtime can reach it.
Does the provider app have to keep running for the variables to exist?
Yes. The registration belongs to the provider process: when it stops, the nodes it registered disappear from the Data Layer and from the OPC UA address space until it starts again. For a bridge that must survive reboots, package the provider as a ctrlX app so the runtime starts it automatically, and treat variables that vanish without a config change as a first sign to check whether the provider process is still alive.
What if one MQTT message carries several measurements?
Register one typed node per measurement and decode the payload once, writing each field to its own address. A JSON object with temperature, humidity and a status flag becomes three nodes under the provider's address space, for example. Writing the whole object into one scalar node fails at the write, and splitting the fields also lets an OPC UA client subscribe to the single value it needs instead of reading all of them.
Which data type should a registered node use?
Match the sensor's native resolution, not the text format of the MQTT payload. A temperature published as a decimal string still belongs in a floating-point node, a counter belongs in an integer node, and status flags belong in boolean nodes. Declaring the type at registration and validating the decoded value before each write is what stops a silent conversion from reaching the OPC UA client as a plausible but wrong number.
What happens when the sensor publishes faster than Node-RED can write?
The Data Layer node holds the most recent accepted value, so publications that arrive while a write is still completing are lost unless the flow queues them. Choose deliberately: a dashboard or a client reading current state can drop intermediate samples without harm, while a logging task must queue every message and watch that queue, because a queue that only grows means the consumer is slower than the sensor and the backlog ends up as delayed values, not missing ones.


