Open DF1AMB opened 3 years ago
this is probably the default value of a variable node. I thinkwe fixed that in asyncua.. can you try it? just curious.
I gave it a try again with the server-minimal.py
The result is still the same.
And you are also right, this is the default value of a variable node. I tried to change the default to None. When doing this _validate in uatypes.py throws an exception.
raise UaError("Non array Variant of type {0} cannot have value None".format(self.VariantType))
https://github.com/FreeOpcUa/opcua-asyncio/pull/427 try that one. it should fix it
Looks promising ... Will also you provide the solution for this project?
I will not have time, but code is very similar so you or someone else can port. Or you can migrate to asyncua. The sync api seems to work fine
@oroulet: Thanks for the fix. it works for me now. I have migrated the project to asyncua.
I will also try to port the code to the sync api, since for other projects I am running migration will no be so easy.
Hello.
I'm using asyncua 0.9.98 but I have the same issue: the ArrayDimensions is set to UInt32
I have checked that this piece of code:
in "_create_variable" function is performed but the result is not correct.
The variable is created in this way:
How can I fix it?
Thanks in advance
UInt32 -1 in UaExpert means NULL or in Python None so everything is correct.
Dear schroeder
Are you sure about this?
UAExpert shows two different values depending on which library I use: for example using prosys library or a B&R server the value shown is Null:
In fact the Beckoff client works fine with B&R or Prosys server while it gives an error (only in writing, reading is correct) with asyncua server.
Thanks for your reply
https://reference.opcfoundation.org/v104/Core/docs/Part3/5.6.2/
ArrayDimensions | O | UInt32[] | This Attribute specifies the maximum supported length of each dimension. If the maximum is unknown the value shall be 0.The number of elements shall be equal to the value of the ValueRank Attribute. This Attribute shall be null if ValueRank ≤ 0. -- | -- | -- | --This Attribute shall be null if ValueRank ≤ 0
Yes you are right but accessing the ArrayDimensions attribute with a client I have found a little difference between the asyncua server:
and the prosys server:
Can this explain the different behaviour of the client?
Sorry,
the second image is wrong! The right one:
If you want to give the same response as prosys you must set the value of the node to NULL if your array is empty. Which is a uncommon behavior for a server to do and I have never seen from any other opc ua server.
I have not an array...I have a variable with scalar value that has an own -not null- value. The issue with the Beckhoff client is related to the fact that the value of the attribute "ArrayDimensions" should be "Null". In my server the value of this attribute is set as "None" but in UAExpert is displayed as "UInt32 Array[-1]". For "non Beckhoff" clients this is absolutely not a problem but for Beckhoff this causes that the variable is not writable. I'm trying to understand if it is possible to solve this issue in the server side.
I have used the server-minimal.py example and tried to connect from an Beckhoff TwinCAT OPC UA Client to the python server. That failed with an client error InvalidNodeHdl. After talking to the Technical support of Beckhoff they told me that refering to the spec of OPC UA 1.04 the ArrayDimension of the Node has to be NULL or not to be reported. But the OPC UA server reports it as [].
To Reproduce
Expected behavior
Screenshot TwinCAT client -> Python server
Screenshot TwinCAT client -> Codesys server
Version
Python-Version: 3.8
python-opcua Version: 0.98.12
If there is any information missing I will provide it as fast as possible.
Thanks