python-opcua
python-opcua copied to clipboard
How to create a variable in ExtensionObject type
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?