node-red-contrib-opcua
node-red-contrib-opcua copied to clipboard
Extension Object can't be created inside OPC-UA Server
I can't execute an "addVariable" command for an ExtensionObject.
The output show this error when executed:
OPC-UA Server msg : error "TypeError: Cannot read property 'toString' of null"
If I'm correct, the server code shown no datatype=ExtensionObject row 650 of https://github.com/mikakaraila/node-red-contrib-opcua/blob/master/opcua/104-opcuaserver.js
Flow: [{"id":"b2238d92.fd329","type":"inject","z":"f6f2187d.f17ca8","name":"New variable siglElem","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"ns=6;s=siglElem;datatype=ExtensionObjectType","payload":"{ "opcuaCommand": "addVariable" }","payloadType":"json","x":220,"y":1520,"wires":[["f810ef29.b0ede"]]},{"id":"f810ef29.b0ede","type":"OpcUa-Server","z":"f6f2187d.f17ca8","port":"53880","name":"OPC-UA Server","endpoint":"UA/SimpleNodeRedServer","autoAcceptUnknownCertificate":true,"registerToDiscovery":false,"constructDefaultAddressSpace":false,"allowAnonymous":true,"endpointNone":true,"endpointSign":false,"endpointSignEncrypt":false,"endpointBasic128Rsa15":false,"endpointBasic256":false,"endpointBasic256Sha256":false,"maxNodesPerBrowse":"","maxNodesPerHistoryReadData":"","maxNodesPerHistoryReadEvents":"","maxNodesPerHistoryUpdateData":"","maxNodesPerRead":"","maxNodesPerWrite":"","maxNodesPerMethodCall":"","maxNodesPerRegisterNodes":"","maxNodesPerNodeManagement":"","maxMonitoredItemsPerCall":"","maxNodesPerHistoryUpdateEvents":"","maxNodesPerTranslateBrowsePathsToNodeIds":"","x":560,"y":1400,"wires":[["ca867ae.353c888"]]},{"id":"ca867ae.353c888","type":"debug","z":"f6f2187d.f17ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":1420,"wires":[]}]
As I said it's not yet complete. It needs bit more work...
How can it be done with the .xml ? If I can implement it, I'll add a PR.
First practice modeling with some UaModeler like https://github.com/FreeOpcUa/opcua-modeler
Then I have to add support for custom nodeset that will load it.
OK, I have prepared custom nodeset loading and added ExtensionObject to addVariable, but I can test this on Monday.
Still some work to do, but progressing:
How is composed the user.json ? Does it contain the data about the ExtensionObject ? I have some issue importing the example file from https://github.com/FreeOpcUa/opcua-modeler on that program instance.
user.json is for username, password and role.
I am still working with custom.xml / customobject.xml that contains type definition. Seems to be some strange things how it is loaded and handled at the server. Needs still some clarification before I can commit code & example.
New version contains support for custom nodeset xml but I didn´t have time to test instantiate extension object. Closer but not yet final... high workload at work.
I got email notification but comment is not visible here.
haph-vi [email protected]
Hi! I need to create a structure like in the picture. I can't find the right settings within opcua-modeler for that.
Within a node-red function block tried it with msg.payload={"opcuaCommand": "addVariable"}; msg.topic='ns=1;s=Systest_Daten;datatype=ExtensionObject'; but there are errors:
"Error: String cannot be coerced to a nodeId : =Systest_Daten;datatype=ExtensionObject"
Is it possible now and am I doing something wrong or is it not implemented yet?
Thanks!
Do you have actual type loaded into the server? I mean nodeset that contains structure and nodeId for the type itself?
Yeah sorry, I posted it and saw that the Extention Object is now featured in the help of the server node (Just updated the module to the latest version). Then I deleted it immediately because I thought I will now figure it out. Turns out, I didn't lol
IN, OUT should be Boolean Arrays (I think), I don't see a possibility to create one, am I right? I don't know what Systest_Daten is, I only have this Screenshot, but I asked for more information already but still waiting.
I also asked for a nodeset, but haven't received an answer yet. I don't find any guide or docs regarding the creation of a nodeset and the different tags. Can you point me onto something?
(I'm now on vacation for the next 2 weeks so I will answer on this post earliest in 2 weeks)
Thanks!
OK, after vacation I had now time to look and fix this. Seems to work at least with AutoID extension objects:
I expect this one can be closed already.