Skip to main content

well_known_nodes

well_known_nodes Module-defined NodeId string constants for standard OPC Foundation nodes. Use them instead of writing them out manually to improve i=2258 code readability.

from darra_opcua import well_known_nodes as wkn   # Module Name darra_opcua (pip package darra-opcua)
# or
from darra_opcua import wkn # Predefined aliases
Supporting

Common Root Nodes​

ConstantsNodeIdMeaning
wkn.ROOT_FOLDERi=84Address Space Root
wkn.OBJECTS_FOLDERi=85Business Data Root
wkn.TYPES_FOLDERi=86Type Definition Root
wkn.VIEWS_FOLDERi=87View Root
wkn.SERVERi=2253The Server Object Itself

Server Status​

ConstantsNodeIdMeaning
wkn.SERVER_SERVER_STATUSi=2256Server Status Structure
wkn.SERVER_SERVER_STATUS_STATEi=2259Status (Running / Failed / ...)
wkn.SERVER_SERVER_STATUS_CURRENT_TIMEi=2258Current server time
wkn.SERVER_SERVER_STATUS_START_TIMEi=2257Server startup time
wkn.SERVER_SERVER_STATUS_BUILD_INFOi=2260BuildInfo (Product / Manufacturer / Version)
wkn.SERVER_SERVER_ARRAYi=2254ServerArray Array of Strings
wkn.SERVER_NAMESPACE_ARRAYi=2255NamespaceArray Array of Strings

Standards ReferenceType​

ConstantsNodeId
wkn.HAS_COMPONENTi=47
wkn.HAS_PROPERTYi=46
wkn.ORGANIZESi=35
wkn.HAS_TYPE_DEFINITIONi=40
wkn.REFERENCESi=31
wkn.HIERARCHICAL_REFERENCESi=33

Common DataType​

ConstantsNodeId
wkn.BOOLEANi=1
wkn.INT32i=6
wkn.UINT32i=7
wkn.INT64i=8
wkn.FLOATi=10
wkn.DOUBLEi=11
wkn.STRINGi=12
wkn.DATE_TIMEi=13
wkn.BYTE_STRINGi=15

WellKnownNamespaces​

from darra_opcua import WellKnownNamespaces

WellKnownNamespaces.OPC_FOUNDATION # "http://opcfoundation.org/UA/"
WellKnownNamespaces.DI # "http://opcfoundation.org/UA/DI/"

Usage​

from darra_opcua import wkn

# ua It is connected. OpcUaSession

# Not recommended: Hard-coding
with ua.read("i=2258") as dv:
print(dv.value)

# Recommendation: Use constants
with ua.read(wkn.SERVER_SERVER_STATUS_CURRENT_TIME) as dv:
print(dv.value)

ServerStatus Read All (Batch)​

from darra_opcua import wkn

nodes = [
wkn.SERVER_SERVER_STATUS_STATE,
wkn.SERVER_SERVER_STATUS_CURRENT_TIME,
wkn.SERVER_SERVER_STATUS_START_TIME,
wkn.SERVER_NAMESPACE_ARRAY,
]
results = ua.read_many(nodes) # List[Optional[OpcUaDataValue]]

names = ["State", "CurrentTime", "StartTime", "Namespaces"]
for name, dv in zip(names, results):
if dv:
with dv:
print(f"{name:13s} = {dv.value}")

Complete List​

Searching the source code — darra_opcua/well_known_nodes.py a total of 55 constants (8 Folders + 16 Servers + 12 ReferenceTypes + 19 DataTypes), all of which are nodes under the standard OPC Foundation namespace ns=0, and their type is str (NodeId string encoding).

Cross-Language Comparison​

ConstantsNaming Conventions The languages are different, but the values are the same (i=NNN strings):

MeaningPythonC#JavaC++RustC
Citation Formatwkn Module ConstantsWellKnownNodes Static Class Constants————
Address Space Rootwkn.ROOT_FOLDERWellKnownNodes.RootFolder————
Business Data Rootwkn.OBJECTS_FOLDERWellKnownNodes.ObjectsFolder————
Current server timewkn.SERVER_SERVER_STATUS_CURRENT_TIMEWellKnownNodes.Server_ServerStatus_CurrentTime————
Standard Namespace URIWellKnownNamespaces.OPC_FOUNDATIONWellKnownNamespaces.OpcFoundation————

Python isModule-Level Underline and Capitalization, C# isStatic Class in PascalCase with underscores separating segments, Namespace DarraOpcUa_Client. Both columns should contain their respective real names; do not copy from the other column.

Java / C++ / Rust / C: The four columns marked "read-only, unverified" in this entry — indicate that the information has not been verified; it does not mean that it does not exist.

Next Step​