Example: OPC
12 min
end to end walkthrough configure the litmus edge opc ua server hierarchy, set security, add a user, and import existing devicehub tags setup from litmussdk import opc the litmus edge opc ua server can publish devicehub tags as opc ua nodes for upstream opc clients (scada, historians, etc ) 1\ inspect current hierarchy root = opc get root node() top level = opc get node by paths(\[]) # children of root 2\ reset to a clean state use with caution; clears the hierarchy opc reset all hierarchy() 3\ build a hierarchy plant node = opc add node folder(parent id=root id, name="plant1") line1 = opc add node folder(parent id=plant node id, name="line1") pump = opc add node device(parent id=line1 id, name="pump 01", device id=device id) 4\ import all tags from a devicehub device opc import all dh tags(device id=device id, parent node id=pump id) 5\ add a specific tag opc add node tag( parent id=pump id, tag id=pressure tag id, name="pressure", ) 6\ add a logic node (computed) opc add node logic( parent id=pump id, name="efficiencyestimate", formula="pressure flowrate / 1000", ) 7\ update security and auth current = opc get security and auth settings() opc change security and auth settings( security modes=\["signandencrypt"], security policies=\["basic256sha256"], user token types=\["username"], ) 8\ service configuration config = opc get service config() opc change service config( port=4840, application name="litmusedge opc ua", enable anonymous=false, ) \# restart the opc ua service to apply opc start stop opc(action="restart") 9\ server certificates and metrics certs = opc get server certificates() metrics = opc get server metrics() 10\ export the hierarchy as json useful for snapshotting or for the air gap features docid\ dmvq8b6h macksn07230r builder hierarchy json = opc export as json() \# re import on another edge opc import json(hierarchy json) see also air gap features docid\ dmvq8b6h macksn07230r including opc config in deployment templates