Hi everyone,
I am trying to read a simple Boolean variable from a CODESYS V3 PLC (SoftPLC on Windows) into Node-RED using node-red-contrib-opcua, but I am consistently getting undefinedas the payload, even though the session seems to be connected.
My Setup:
- PLC: CODESYS Control Win V3 x64
- Node-RED: Running locally.
- Library: node-red-contrib-opcua
- Auth Method: Anonymous (Allowed in CODESYS Runtime Security Policy).
- UaExpert: Works perfectly. I can connect Anonymously and read/write the variables without issue.
The Problem: In Node-RED, the OpcUa-Clientnode connects successfully (I see the “Session active” status and the log userIdentity is ANONYMOUS). However, whenever I try to READ a variable, the debug node shows msg.payload : undefined.
What I have tried so far:
- Verified NodeID: I copied the NodeID directly from UaExpert.
- Example: ns=4;s=|var|CODESYS Control Win V3 x64.Application.PLC_PRG.xStart
- Checked Namespace Index:
- UaExpert showsns=4 .
- Node-REDOpcUa-Browser node shows objects at ns=2.
- I have tried forcing the inject topic to use ns=2, ns=3, and ns=4. All returns undefined.
- Direct Inject Method:
- I bypassed the “Item” node and injected msg.topicdirectly into the Client node set to READ. Quiet undefined.
- Standard Server Test:
- I tried reading the standard OPC UA ServerState variable ( ns=0;i=2259).
- Result: undefined .
Logs/Output: Node-RED Debug window shows:
Plain text
“userIdentity is ANONYMOUS” msg.payload : undefined
Question: Since UaExpert works with Anonymous, but Node-RED gets undefined even for standard server variables does CODESYS treat the Node-RED “Anonymous” session differently? Do I need to manually trust a certificate even for Anonymous login, or is there a specific setting in CODESYSControl.cfgI am missing?
Any help would be appreciated!