Hi @all,
for a project I try to create an OPC DA - UA converter. I used the OpcUa-Server Node. It works pretty well, but I am getting the error message in debug window "TypeError: Cannot read property 'indexOf' of undefined" when trying to write values to the server...
I have no clue how to debug. Can anyone help me?
[{"id":"be352d9834842150","type":"tab","label":"OPC DA - UA converter","disabled":false,"info":"","env":[]},{"id":"f418194b3b0b389b","type":"opc-da in","z":"be352d9834842150","group":"719b4086d6ffcaaa","mode":"all","diff":false,"name":"","item":"","x":220,"y":600,"wires":[["7a0f1613.c21c88"]]},{"id":"37e99d8c.747622","type":"comment","z":"be352d9834842150","name":"convert and write the variables to the OPC-UA Server","info":"","x":580,"y":200,"wires":[]},{"id":"ae82e5a4.7264b8","type":"comment","z":"be352d9834842150","name":"OPC DA connection to WinCC","info":"","x":160,"y":200,"wires":[]},{"id":"7a0f1613.c21c88","type":"function","z":"be352d9834842150","name":"DAconvertUA","func":"\nwhile(global.get('counter') <= (global.get('SumVar')-1)) //Replace 1 to number of OPC DA values\n{\n var msgOUT = {payload: {\n \"messageType\": \"Variable\", \n \"variableName\": msg.payload[global.get('counter')].topic, \n \"variableValue\": msg.payload[global.get('counter')].value } \n };\n \n msgOUT.payload.namespace = 1\n\n//Reset counter when number of Tags reached\nif(global.get('counter') == (global.get('SumVar')-1) ) \n{\n global.set('counter',0);\n}\nelse //count while number of tags not reached\n{\n global.set('counter',global.get('counter')+1)\n}\n\n\nreturn msgOUT;\n}\n\n\n\n\n\n\n\n\n\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":600,"wires":[["79e5a3b30914934e","5ad343c3af8b196a"]]},{"id":"33681d89.40ea32","type":"inject","z":"be352d9834842150","name":"","repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"counter","payloadType":"global","x":200,"y":100,"wires":[["76100c76.1e9be4"]]},{"id":"76100c76.1e9be4","type":"function","z":"be352d9834842150","name":"INIT_counter","func":"\nglobal.set('counter',0)\n\n\n\n\n\n\n\n\n\n\n\n\n","outputs":1,"noerr":0,"x":390,"y":100,"wires":[[]]},{"id":"89cb6c09.23a87","type":"comment","z":"be352d9834842150","name":"Create global counter for DAconvertUA node","info":"","x":210,"y":40,"wires":[]},{"id":"df45dff6.450d2","type":"inject","z":"be352d9834842150","name":"","props":[{"p":"payload","v":"SumVar","vt":"global"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"SumVar","payloadType":"global","x":640,"y":100,"wires":[["d828b77.c938248"]]},{"id":"d828b77.c938248","type":"function","z":"be352d9834842150","name":"INIT_SumVar","func":"\nglobal.set('SumVar',2)\n\n\n\n\n\n\n\n\n\n\n\n\n","outputs":1,"noerr":0,"x":840,"y":100,"wires":[[]]},{"id":"c524b5d.ac4e248","type":"comment","z":"be352d9834842150","name":"Create global number of OPC Tags for DAconvertUA node","info":"","x":750,"y":40,"wires":[]},{"id":"79e5a3b30914934e","type":"OpcUa-Server","z":"be352d9834842150","port":"53880","name":"","endpoint":"","users":"users.json","nodesetDir":"","folderName4PKI":"","autoAcceptUnknownCertificate":true,"registerToDiscovery":false,"constructDefaultAddressSpace":true,"allowAnonymous":true,"endpointNone":true,"endpointSign":true,"endpointSignEncrypt":true,"endpointBasic128Rsa15":true,"endpointBasic256":true,"endpointBasic256Sha256":true,"maxNodesPerBrowse":0,"maxNodesPerHistoryReadData":0,"maxNodesPerHistoryReadEvents":"10","maxNodesPerHistoryUpdateData":"10","maxNodesPerRead":"10","maxNodesPerWrite":"10","maxNodesPerMethodCall":"10","maxNodesPerRegisterNodes":"10","maxNodesPerNodeManagement":"10","maxMonitoredItemsPerCall":"10","maxNodesPerHistoryUpdateEvents":"10","maxNodesPerTranslateBrowsePathsToNodeIds":"10","maxConnectionsPerEndpoint":20,"maxMessageSize":4096,"maxBufferSize":4096,"x":700,"y":320,"wires":[[]]},{"id":"5ad343c3af8b196a","type":"debug","z":"be352d9834842150","name":"debug 1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":580,"wires":[]},{"id":"c801d7c78f703730","type":"debug","z":"be352d9834842150","name":"debug 2","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":660,"wires":[]},{"id":"be614affd9e75629","type":"inject","z":"be352d9834842150","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":150,"y":360,"wires":[["3e4b21ebf7a8bb71"]]},{"id":"3e4b21ebf7a8bb71","type":"function","z":"be352d9834842150","name":"","func":"\n{msg.payload = {opcuaCommand:\"addFolder\"}\nmsg.topic = \"ns=1;s=Plant202\"}\n\n\n\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":360,"wires":[["79e5a3b30914934e"]]},{"id":"25ce268afa0aacc1","type":"inject","z":"be352d9834842150","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"","payloadType":"date","x":150,"y":420,"wires":[["90ddceacae3c4400"]]},{"id":"90ddceacae3c4400","type":"function","z":"be352d9834842150","name":"","func":"\n\n\n msg.payload = { opcuaCommand: \"addVariable\" }\n msg.topic = \"ns=1;s=OPC_Sim_Val_1;datatype=Int32\"\n\n\n\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":420,"wires":[["79e5a3b30914934e"]]},{"id":"b3d7b8502308b172","type":"inject","z":"be352d9834842150","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":150,"y":480,"wires":[["8f42bca1f9baf8ab"]]},{"id":"8f42bca1f9baf8ab","type":"function","z":"be352d9834842150","name":"","func":"msg.payload = { opcuaCommand: \"addVariable\" }\nmsg.topic = \"ns=1;s=OPC_Sim_Val_2;datatype=Int32\"\n\n\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":480,"wires":[["79e5a3b30914934e"]]},{"id":"719b4086d6ffcaaa","type":"opc-da group","server":"af81697d3b47a3d3","updaterate":"5000","deadband":"0","active":true,"validate":true,"vartable":[{"item":"OPC_Sim_Val_1"},{"item":"OPC_Sim_Val_2"}],"name":"WinCC Server 02"},{"id":"af81697d3b47a3d3","type":"opc-da server","address":"192.168.0.50","domain":"WORKGROUP","progid":"","clsid":"75d00bbb-dda5-11d1-b944-9e614d000000","verbose":"default","name":"OSS02","vartable":[],"timeout":"5000"}]