An OPC UA event subscription can return EnabledState correctly while returning Null for EnabledState/Id. The select clause is the cause: Id is a nested event field, so the filter must represent its browse path as an array of QualifiedName elements.
Identify the failing select clause
The monitored item targets ObjectIds.Server in MonitoringMode.Reporting. The event notification contains EnabledState = Enabled, but EnabledState/Id = Null, even though UaExpert displays the nested value.
The failing configuration converts the nested path into one string:
monitoredItem.Filter.SelectClauses.Add(
AbsoluteName.ToString(BrowseNames.EnabledState, BrowseNames.Id));
Represent the nested browse path correctly
When an event field node is not referenced directly by the event type, pass each browse-path element separately in a QualifiedName[]. Replace the string-based clause with:
monitoredItem.Filter.SelectClauses.Add(
ObjectTypeIds.ConditionType,
new QualifiedName[] {
BrowseNames.EnabledState,
BrowseNames.Id
});
| Field request | Representation | Observed result |
|---|---|---|
EnabledState |
Direct browse name | Value returned |
EnabledState/Id |
Single string from AbsoluteName.ToString
|
Null |
EnabledState/Id |
Two-element QualifiedName[]
|
Correct nested-path configuration |
Apply and verify the correction
- Remove the
AbsoluteName.ToString(BrowseNames.EnabledState, BrowseNames.Id)select clause. - Add the clause using
ObjectTypeIds.ConditionTypeand the ordered path elementsBrowseNames.EnabledStatefollowed byBrowseNames.Id. - Create the monitored items again and generate an alarm event that changes state.
- Inspect the corresponding field in
NewEvent.Event. Confirm thatEnabledState/Idno longer appears asNulland agrees with the value visible in UaExpert.
Use the same path construction for the other nested state identifiers already requested by the filter: AckedState/Id and ActiveState/Id. Preserve the parent-to-child order in each QualifiedName[].
FAQ
Why is OPC UA EnabledState returned but EnabledState/Id is Null?
EnabledState is selected directly, while Id is nested beneath it. Represent the nested field with a two-element QualifiedName[] instead of one path string.
What select clause retrieves ConditionType EnabledState Id?
Use ObjectTypeIds.ConditionType with new QualifiedName[] { BrowseNames.EnabledState, BrowseNames.Id }.
How should AckedState/Id and ActiveState/Id be selected?
Apply the same parent-to-child array pattern: pair BrowseNames.AckedState or BrowseNames.ActiveState with BrowseNames.Id in a QualifiedName[].