Troubleshooting
Why Node-RED reads OPC UA data but gets no alarms or events
Short answer
Reading OPC UA variables in Node-RED proves the session works; it proves nothing about alarms, because values and events travel as separate subscriptions. Wire an OpcUa-Event node to the Server object, filter on the base event type, set the client action to events, and confirm the endpoint actually exposes event notifiers; a Classic AE-only source needs an AE-to-UA gateway.
On this page
Node-RED reads your OPC UA variables without trouble, and no alarm ever arrives, because values and events travel as separate subscriptions and your flow built only the first one. A client can sit in a healthy session, stream every variable change, and hold no event subscription at all, so the silence you see is the expected result of this configuration, not a fault in the data path. The fix has two halves: build the event branch deliberately — an OpcUa-Event node on the standard Server object with the base event type, fed through the client node with its action set to events — and prove independently that the endpoint Node-RED reaches actually publishes event notifiers. Where the alarm source is OPC Classic AE only, no Node-RED wiring will ever receive it; that case needs an AE-to-UA mapping in front of Node-RED, and the decision for each case is at the end.
Values and events are separate subscriptions #
OPC Classic DA, OPC Classic AE, and OPC UA are three different interfaces, and a working connection to one of them carries no information about the others. Inside OPC UA the separation continues: monitoring a variable and monitoring events are different operations that a client requests separately. Your flow reads data because a node in it created a value subscription. Nothing in it has ever asked the server for events, so the server sends none, and nothing arriving is exactly what a session without an event subscription should produce.
Keep the two branches as separate flows. The data branch — variables read and forwarded onward, for example to a broker — is the subject of bridging OPC UA PLC data to MQTT with an edge PC, and it works independently of the event branch you are about to add.
An event branch comes down to three decisions: which object you watch, which event types you accept, and which action the client node performs. Set all three correctly and alarms arrive; miss any one and you get the silence you have now.
Prove what the passing test actually showed #
First, name the interface your successful alarm test used. A test that exercised the Classic AE interface proved the Classic server raises events; it proved nothing about the OPC UA endpoint Node-RED opens, because the two interfaces share neither session nor subscription. No client ever inherits another client's connection either — Classic clients face the same requirement in their own form, where a C# OPC DA client needs its own RSLinx Classic server instead of another tool's session, and a UA client likewise has to build its own event subscription.
Second, test the UA endpoint itself. Point a second, event-capable UA client at the same endpoint URL with the same security settings and identity Node-RED uses, trigger a controlled event through the server's own test facility or an approved process transition — never by forcing a live safety alarm — and see whether that client receives it. This is the same isolation move as in troubleshooting Node-RED OPC UA when UaExpert connects: an independent client splits a suspected flow fault from a suspected server fault.
Decide from that result. If the second client receives events at that endpoint, the server side is good and the flow is the fault — build the branch in the next section. If it receives none, no Node-RED setting can help, because the endpoint publishes no events — go to the gateway section further down.
Wire the event path in Node-RED #
The nodes come from node-red-contrib-opcua, the package built on the node-opcua stack. Install it from the palette manager or with npm from your Node-RED installation directory, then confirm the palette actually lists the OpcUa-Event node and the OpcUa-Client node. Take every field meaning from the installed package's own help rather than from a flow screenshot, because package versions move details around.
The minimal bench flow #
Build four nodes and nothing else — no dashboard, no database, no acknowledgment logic — until the raw event lands:
- An
injectnode that fires the request. In the published event example flow for this package it is the test-events trigger; it starts the subscription request and does not itself raise an alarm. - The
OpcUa-Eventnode, which builds the event request. - The
OpcUa-Clientnode carrying the endpoint configuration, with its action set toevents. - Two
debugnodes set to show the complete message: one after the event node, one after the client node.
A message after the event node proves only that the request was constructed. The output that decides anything is on the client side, and until an event lands there nothing downstream can be trusted. The package's example flows point at a simulation endpoint with security set to None; that is a bench value, and the production endpoint gets the security policy and identity your plant standard requires.
The three settings that decide it #
| Setting | Example value | What it does |
|---|---|---|
| Root object | ns=0;i=2253 |
The standard Server object, which reports everything the server publishes |
| Event type | i=2041 |
BaseEventType, the broadest filter in the event type hierarchy |
| Client action | events |
Creates an event subscription instead of a value read |
Start at the Server object because it is where the server reports all the events it generates. A more specific notifier from the address space works too, but only once you have browsed it and confirmed the object carries event notifications — a syntactically valid node identifier is no proof that the object behind it supports events.
i=2041 is BaseEventType, and the OPC UA alarm and condition model defines alarm types as extensions of that base, so a filter at the base receives every alarm class the server raises. Take the broad filter first on purpose: a narrow type filter set before the path is proven can silently exclude exactly the alarm you want. Select the event fields your logic needs while you are there; the standard Time field is set as close to the event generator as the underlying system allows, which makes it the reliable one for ordering.
Narrow the filter only after the base type works #
Once BaseEventType events are landing in the debug output, browse the server's address space for the specific alarm type behind your alarms, switch the event type filter to it, and retest with the same test window as before. Confirm the received messages contain the fields your downstream logic needs before anything depends on them. Acknowledgment is a separate call keyed to the event's identifiers — commission it only after reception is stable, not inside the bench flow.
How long to wait before calling it broken #
Give the bench test a window derived from the subscription's update interval, because an event raised just after a publish cycle waits one full cycle before delivery. The example client configuration for this package sets that interval with time at 10 and timeUnit at s; check the installed node's help for what those fields control before changing them. Worked example: an interval of 10 s means worst-case first delivery is one full cycle after the event, so the test window is two cycles, 2 × 10 s = 20 s. If the client output is still empty after that window while the independent client receives events, the subscription was never established — recheck the endpoint, security, and client action. A different interval scales the window the same way, and the interval is a delivery cadence, not an alarm-response guarantee.
When no OPC UA endpoint carries the alarms #
If the independent client came up empty, the endpoint Node-RED reaches publishes no events, and no Node-RED setting changes that. Many controllers and gateways ship with alarm reporting disabled at the UA endpoint; enabling it is server-side configuration done per the server vendor's documentation, and the independent-client test confirms it before Node-RED enters the picture.
If the alarm source speaks only OPC Classic AE, the path is different. node-red-contrib-opcua is an OPC UA stack, so it cannot attach to a Classic AE server no matter how well that server tests in a Classic tool. Two legitimate paths exist: place a gateway with an explicit AE-to-UA mapping in front and verify the event mapping with the independent-client test before building any flow — a DA-to-UA bridge maps data and never events — or use an integration component that explicitly supports Classic AE. Choose the gateway for its alarm mapping, not its data mapping; a bridge's data credentials say nothing about its event path.
Symptoms and the boundary each one points to #
- Variables read, no events, independent client also silent. The endpoint publishes no events. Fix the server or gateway side first; nothing in the flow is wrong or fixable.
- Variables read, no events, independent client receives. The flow lacks a working event subscription. Check the client action against
events, the event node's wiring, and the root object. - A message appears after the event node but the client output stays empty. The request was built but the subscription never came up. Recheck the endpoint URL, security policy, credentials, and that the inject fired after the client connected.
- Events arrive but your expected alarm is missing. The type filter is too narrow or the alarm class is not raised at this endpoint. Broaden back to BaseEventType, retest, then narrow again.
- You expected the inject to raise the alarm. It does not; it only starts the subscription request. Generate the event at the server through its test facility or an approved process transition.
The decision for each case #
- OPC UA endpoint already publishes events: build the bench flow, point the event node at the Server object with the base event type and the client action at
events, confirm arrival inside the two-cycle window, then narrow the filter to the alarm type and hand the branch to production. - UA endpoint silent, server supports alarms: enable event publication at the UA endpoint per the vendor's documentation, re-prove it with the independent client, then build the flow.
- Classic AE only: put an AE-to-UA gateway mapping in the path or use a Classic AE-capable integration component, verify the event mapping independently, and only then build the Node-RED branch.
In every case the order is the same: prove an event path exists at the endpoint, build the subscription, narrow the filter last.
Questions asked
Does the working data subscription help the event subscription?
They can share one OPC UA session, but nothing else carries over. A session transports only what a client has subscribed to; your flow subscribed to variables, so values arrive and events do not. Adding an event subscription on that same session is normal and does not disturb the data branch. Working data is never evidence that events are enabled.
Which object should the event subscription watch?
Start at the Server object in namespace 0 with identifier 2253, because it reports everything the server publishes. A more specific notifier found in the address space works only after you have browsed it and confirmed it carries event notifications. A syntactically valid node identifier is never proof that the object behind it supports events.
Which event type catches every alarm?
BaseEventType, identifier 2041 in namespace 0. The OPC UA alarm and condition model defines alarm types as extensions of that base, so a subscription filtered at the base receives every alarm class the server raises. Start there to prove the path, then narrow to the specific alarm type you browsed from the server, because a narrow filter applied first can hide the alarm you want.
Can Node-RED acknowledge alarms it receives?
Yes, but only after reception is stable. Acknowledgment is a separate call that must reference the exact event, keyed to identifiers such as the AlarmID and EventID carried in the event message, which is how the published example flow for this package does it. After acknowledging, confirm on the server side that the alarm's state actually changed rather than trusting the return message alone.
Can node-red-contrib-opcua connect to an OPC Classic AE server directly?
No. The package is built on node-opcua and speaks OPC UA only, so it cannot attach to a Classic AE server regardless of how well that server tests in a Classic tool. Either place a gateway that maps Classic AE notifications into OPC UA events and verify that mapping with an independent UA client, or use an integration component that explicitly supports Classic AE.