0
votes

I am very new to OPC UA, so please excuse if this is a very basic question.

I want to call a method with two input arguments. The input arguments are described as follows: Input arguments

What I have tried is this:

evse = client.get_node("ns=6;s=::EVSE")
set_default = client.get_node("ns=6;s=::EVSE:SetDefault")
res = evse.call_method(set_default, 1, 20)

Which yields this error:

BadInvalidArgument: "One or more arguments are invalid."(BadInvalidArgument)

If I replace the last line by this

res = evse.call_method(set_default, [1, 20])

I get this error:

BadArgumentsMissing: "The client did not specify all of the input arguments for the method."(BadArgumentsMissing)

When I call the method manually from UaExpert, it works fine. Can somebody give me a hint how to proceed?

Edit: These are the argument structures expanded:

Argument structures

1
What are the expected datatypes of each argument? Expand the Argument structures in the UaExpert screenshot and add it to your question. - Kevin Herron
The first is uint16 and the second is float. I added a screenshot to the question. - Dave
They were able to help me over at Github. This solved the problem for me. - Dave

1 Answers

0
votes

Does the Python library automatically cast the method arguments for you?

Maybe you're just not providing values of the correct datatype in your first attempt; try this instead:

res = evse.call_method(set_default, 1, 20.0)

Or look into the documentation or source code to see if this is required of you. I also don't know if there's a special unsigned "wrapper" class you would need to use for the first argument if the library doesn't do this casting for you.