IMD SolutionComputing LibraryShop main store

Troubleshooting

Why a Node-RED OPC UA write reports success but the value stays 0.0

Edge computing and IIoT Published 6 min read By IMD Solution engineering team

Short answer

A green write status is the node's label, not the server's stored value. Verify the exact NodeId, send a numeric payload for the Float item, read the per-item result on the client's output ports, and if the readback still shows the default, isolate the installed node-red-contrib-opcua version — reported at 0.2.350 — by pinning an earlier release or switching node packages, then prove the fix with an independent read.

On this page
  1. A green status is not a write confirmation
  2. Check the target NodeId before anything else
  3. Send a number, not a string
  4. Read the per-item result on the client's output ports
  5. Worked example: writing 66.6 to a Float variable on node-red-contrib-opcua 0.2.350
  6. Isolate the package version
  7. The decision for each outcome
  8. Questions asked

A write that the client node labels "value written" is not a write confirmation. In the case behind this article, an inject node fed an OpcUa-Item and an OpcUa-Client in write action, the node showed the green status, and an independent read in Prosys OPC UA Browser still returned the Float variable's default. The fix is to verify the write at four hops — the payload's runtime type, the target NodeId, the per-item result on the client's output ports, and the server's stored value — and then isolate the package version. The reported combination, an inject-driven update on node-red-contrib-opcua 0.2.350, matches a documented package issue, so version isolation is the check that settles it.

A green status is not a write confirmation #

OPC UA Part 4 defines the Good StatusCode to mean the operation completed normally and the result is valid. It is the server's answer for one service call on one item, nothing more; it does not promise that the value you read afterwards matches the one you sent. The client node's status label summarizes what it sent and what came back for that call. The only confirmation that counts is an independent read of the same NodeId after the write.

Work the four hops one at a time, with a debug node on each:

  • The message leaving the inject node: the value and its runtime type, not the rendered text.
  • The OpcUa-Item node: the complete NodeId and the declared data type.
  • The OpcUa-Client node: the per-item write result on its output ports.
  • The server: the stored value, read through a path the write did not use. The reading techniques in how Node-RED reads PLC data over OPC UA, MQTT or Modbus apply on this read side as well.

Check the target NodeId before anything else #

The flow targets the string NodeId ns=1;s=FESP_100144.Electricity.I_Zone_2 in namespace index 1, with a browse name appended to the item string. The identity is the NodeId; the browse name is decoration as far as addressing goes. Read the variable's actual NodeId in the server's address space and the index it holds in that server's namespace table. A namespace index is a position in this server's own array, not a stable identifier: recreate the folder structure or re-register the namespace and the index can move.

A write addressed to the wrong node can still return Good, which is why the target check precedes every other diagnosis; the same trap appears when a Node-RED S7 read succeeds on the wrong DB address. Compare the full identifier character by character between the flow's item and the variable you inspect in Prosys.

Send a number, not a string #

The inject sets its payload type to str, so the runtime payload is the text "66.6", while the item declares Float. An OPC UA variable has a defined data type and a write must deliver a compatible value; a server that receives text for a numeric variable reports BadTypeMismatch, hex 0x80740000. Some node packages convert silently, and the flow configuration alone does not show the runtime type the server actually received. Check the debug output's payload type right after the inject, then run a controlled test with the payload set to the number 66.6 and the item still Float. The same boundary trips writes on other numeric types, as when an OPC UA Int16 write fails because the payload is a string.

Read the per-item result on the client's output ports #

The flow wires all three outputs of the OpcUa-Client to debug nodes set to complete message — keep that, and read the messages, not the node's status label. A result entry that names the NodeId and carries an error code means the write was refused; resolve that code before anything else. A result that reports Good while an independent read still returns the old value points past the service call, at the payload, the target or the package.

Two settings are not suspects here: security mode and policy set to None, and the endpoint opc.tcp://localhost:4840. They describe the transport. A session that connects to a server on the same host says nothing about one variable's write result, and changing security settings is not a response to a value that stays stale.

Worked example: writing 66.6 to a Float variable on node-red-contrib-opcua 0.2.350 #

Inputs, all from the reported flow: inject payload the string "66.6"; datatype Float; item NodeId ns=1;s=FESP_100144.Electricity.I_Zone_2; client action write against opc.tcp://localhost:4840; installed package node-red-contrib-opcua at version 0.2.350; the server-side update and the client write both left the read value unchanged.

Rule: a write is confirmed only when an independent read of the same NodeId returns the value you sent. No node status substitutes for that read.

Trace the hops:

  1. Debug after the inject shows payload 66.6 with type string — the server can expect a Float and receive text.
  2. The item repeats the same NodeId and declares Float — target and declared type look right.
  3. The client's outputs show the write going out with no error, status "value written".
  4. Prosys reads the same NodeId and returns 0.0, the default.

Result: 66.6 sent, 0.0 read back, and the gap is not rounding. With no per-item error, and the server-side update failing the same way as the localhost client write, the remaining variable is the package version.

Decision: on 0.2.350 with an inject-driven update and the NodeId and payload type verified, treat the package as the suspect and move to version isolation. On any other version, or while the NodeId and runtime payload type are still unverified, work hops 1 and 2 first before touching the package.

Isolate the package version #

The issue record for node-red-contrib-opcua 0.2.350 describes this symptom: an inject node cannot change a server variable's value, with no error returned. It notes that updating a variable from an inject node works again after the fix, provided the variable's NodeId is sent in msg.topic as well. Engineers reporting the same situation give two workarounds: uninstall the installed version and pin an earlier release, or switch the flow to node-red-contrib-opcua-suite, whose item syntax differs and needs rework.

Isolate one variable at a time. Export and preserve the flow, record the installed version, change only the package, and rerun the same inject, write and independent read. The reports name no corrected release number, so verify the candidate version against your own runtime instead of assuming any later release fixes it.

The decision for each outcome #

  • Prosys reads the value you sent: the write path is observable end to end. Repeat the write-and-read pair twice to confirm it holds, then record the package version and flow that passed.
  • The per-item result carries an error code: resolve that code first. A type mismatch points back to the runtime payload type; a refused write points at the server's write access for that variable.
  • Both an earlier release and node-red-contrib-opcua-suite still fail the readback: the reported regression is not your cause. Return to the NodeId comparison and the runtime payload type.
  • The readback stays at the default on 0.2.350 with everything else verified: keep the pinned earlier version or the alternate package in service until you have validated a later release with the same write-and-read test.

Until an independent readback confirms the value, treat the variable as unconfirmed and keep anything that consumes it — a setpoint, a reported energy total — out of service, because a write that silently fails leaves the old value in place while the operator believes a new one is there.

Questions asked

Which status codes mean the server actually refused the write?

BadTypeMismatch, hex 0x80740000, means the value you sent does not match the variable's declared data type. BadWriteNotSupported, hex 0x80730000, means the server does not support the combination of value, status and timestamps you supplied. If you see neither and the node still claims success while the value stays put, the fault sits before the service result: the target NodeId, the runtime payload type or the package version.

Can the server node itself confirm that a write arrived?

With node-red-contrib-opcua-compact-server, yes: the node accepts writes and emits a WriteRequest message from its output, so wiring that output to a debug node shows whether the server saw the write, independent of any client in the flow.

How do I stop a variable from being written?

Recent releases of node-red-contrib-opcua add the opcua-rights node, which sets folder and variable access level plus role and permissions. A write to a protected variable then returns an explicit refusal instead of a status that looks like success.

How do I test a candidate package version without touching the running flow?

Export the flow first and note the installed version in the global config node. Install the earlier release, or node-red-contrib-opcua-suite, in a separate test instance of Node-RED, run the same inject, write and independent read against the same NodeId, and record the exact version and result before changing production.

Keep reading

  • Selection guide

    Node-RED OPC UA server node selection for edge gateways

    Install node-red-contrib-opcua as the pilot OPC UA server package on the first edge gateway, through the Node-RED editor's Manage palette, and keep node-red-contrib-opcua-server as the evaluated fallback. A fleet rollout past a thousand gateways is justified only when the pilot passes the qualification table: server function, real-client interoperability, NodeId stability across restarts, quality behavior, security policy and install reproducibility, all on a recorded software stack.

    Edge computing and IIoT

  • Troubleshooting

    Why a Node-RED OPC UA server shows no data for Integer variables

    The Integer declaration is the fault: Integer is an abstract type in the OPC UA hierarchy, so the variable carries no encoding a client can read, while Double is concrete and works. Declare one concrete integer type such as Int16 identically in namespace.addVariable() and the Variant, store a context number that fits its range, then verify the reported type, a Good status, a changed read and a write that returns Good.

    Edge computing and IIoT

  • Troubleshooting

    Why node-red-contrib-iiot-opcua installs with 3 npm vulnerabilities

    The install did not fail: the transcript shows npm completing a global install, and the three reported vulnerabilities are audit findings on a dependency tree no update will change, because node-red-contrib-iiot-opcua is deprecated and closed since April 2020. Back up the flows, run npm audit fix followed by npm audit, and migrate new work to node-red-contrib-opcua after checking node compatibility.

    Edge computing and IIoT

Why a report table shows 1 instead of historian values