client_deleting.py
Go to the documentation of this file.
00001 import sys
00002 sys.path.insert(0, "..")
00003 import logging
00004 
00005 from opcua import Client
00006 from opcua import ua
00007 
00008 
00009 if __name__ == "__main__":
00010     logging.basicConfig(level=logging.WARN)
00011 
00012     client = Client("opc.tcp://admin@localhost:4840/freeopcua/server/") #connect using a user
00013     try:
00014         client.connect()
00015 
00016         objects = client.get_objects_node()
00017         folder = objects.add_folder("ns=2;i=3007", "2:Folder1")
00018         var = folder.add_variable("ns=2;i=3008", "2:Variable1", 3.45)
00019         # Now getting a variable node using its browse path
00020         var.set_value(9.89) # just to check it works
00021 
00022         results = client.delete_nodes([folder, var])
00023         try:
00024             #var.set_value(9.89) # just to check it does not work
00025             var.get_browse_name()
00026         except ua.UaStatusCodeError:
00027             print("The variable has been removed OK")
00028 
00029     finally:
00030         client.disconnect()


ros_opcua_impl_python_opcua
Author(s): Denis Štogl , Daniel Draper
autogenerated on Sat Jun 8 2019 18:26:23