Created
October 27, 2014 20:53
-
-
Save gbrennon/b0cc6a4914d5359d2390 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# examples/pyuaf/client/easiest_client_example.py | |
# Start the demo server ($SDK/bin/uaservercpp) of Unified Automation before running this script! | |
import pyuaf | |
from pyuaf.util import Address, NodeId | |
from pyuaf.client import Client | |
from pyuaf.client.settings import ClientSettings | |
# create a client named "myClient", and provide the discovery URL of the server (uaservercpp): | |
myClient = Client(ClientSettings("myClient", ["opc.tcp://localhost:48010"])) | |
# specify the address of the node of which we would like to read its Value attribute: | |
# (here we're using an absolute address, i.e. a NodeId(<identifier>, <namespace URI>) and a <server URI>) | |
someAddress = Address(NodeId("Demo.SimulationSpeed", # NodeId identifier | |
"http://www.unifiedautomation.com/DemoServer"), # NodeId namespace URI | |
"urn:UnifiedAutomation:UaServerCpp") # server URI | |
# read the Value attribute of the node that we just addressed: | |
result = myClient.read( [someAddress] ) | |
print("The value is %d" %result.targets[0].data.value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment