python-opcua icon indicating copy to clipboard operation
python-opcua copied to clipboard

How to create a variable in ExtensionObject type

Open ZionDeng opened this issue 2 years ago • 0 comments

What I want:

  • I want to Create an Object in ExtensionObject type

What I tried:

  • I wrote the code below
from opcua import ua, Server, Node


server = Server()
ns = server.register_namespace('fake plc ns')
plc_root = server.nodes.objects.add_object(ns, "FakePLC")

url = "opc.tcp://localhost:4840"
root: Node = plc_root
k, v = 'stateMachine', {'idle', True}
value = ua.Variant(v, ua.VariantType.ExtensionObject)
root.add_variable(ns, k, value, ua.VariantType.ExtensionObject)

My error:

Exception has occurred: AttributeError
type object 'ObjectIds' has no attribute 'set'
  • Could you help me find what should I change?

ZionDeng avatar Mar 20 '22 15:03 ZionDeng