Coder Social home page Coder Social logo

opcua-commander's Introduction

CLI OPCUA Client with NodeOPCUA

alt text

Get it from the Snap Store

install from npm

$ npm install opcua-commander -g
$ opcua-commander -e opc.tcp://localhost:26543 

install from source

$ git clone https://github.com/node-opcua/opcua-commander.git
$ cd opcua-commander
$ npm install
$ npm install -g typescript
$ npm run build
$ node dist/index.js -e opc.tcp://localhost:26543 

install on ubuntu

if you have EACCES error on linux,

 $ npm install -g opcua-commander --unsafe-perm=true --allow-root
 $ sudo npm install -g opcua-commander --unsafe-perm=true --allow-root

run with docker

build your docker image

$ docker build . -t commander

Run the docker image

$ docker run -it commander -e opc.tcp://localhost:26543     

opcua-commander's People

Contributors

aschaepper avatar cacamille3 avatar coussej avatar dependabot[bot] avatar dusanstojkovic avatar erossignon avatar fbrisa avatar glumb avatar maanenh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opcua-commander's Issues

Won't Start

After doing npm install opcua-commander -g and trying to start the program, it errors with the following.

C:\Users\gpresland\AppData\Roaming\npm\node_modules\opcua-commander\node_modules\node-opcua\node_modules\better-assert\index.js:37
  throw err;
  ^
AssertionError: fs.existsSync(options.certificateFile)
    at OPCUAClientBase (C:\Users\gpresland\AppData\Roaming\npm\node_modules\opcua-commander\node_modules\node-opcua\lib\client\client_base.js:65:5)
    at new OPCUAClient (C:\Users\gpresland\AppData\Roaming\npm\node_modules\opcua-commander\node_modules\node-opcua\lib\client\opcua_client.js:67:21)
    at Object.<anonymous> (C:\Users\gpresland\AppData\Roaming\npm\node_modules\opcua-commander\index.js:91:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\Users\gpresland\AppData\Roaming\npm\node_modules\opcua-commander\bin\opcua-commander:3:1)

Wrong version displayed in 0.31.0

when installed with npm install opcua-commander -g and the following info

‭npm info opcua-commander

[email protected] | MIT | deps: 7 | versions: 47
OPCUA CLI client
https://github.com/node-opcua/opcua-commander#readme

keywords: opcua, iot, iiot, cli, curses, blessed

bin: opcua-commander

dist
.tarball: https://registry.npmjs.org/opcua-commander/-/opcua-commander-0.31.0.tgz
.shasum: bfe106097b75e7dce157e4b25a46d7d0993a7196
.integrity: sha512-DbmgjP4W3t7eb9RyJ6b1RTLEFzJ7gBqU6WCIOsHl8Zf3+ORr333yhX9jcV6CMu+UljB/dnggaHoeNR2OYL2lyg==
.unpackedSize: 195.1 MB

dependencies:
blessed: ^0.1.81                         node-opcua-pki: ^4.2.1                   
chalk: 4.1.2                             wordwrap: ^1.0.0                         
node-opcua-certificate-manager: ^2.108.0 yargs: 17.5.1                            
node-opcua-client: ^2.108.0              

maintainers:
- erossignon <[email protected]>

dist-tags:
latest: 0.31.0  

published a month ago by erossignon <[email protected]>

a wrong version is displayed in the welcome screen:
image

Will not start: missing client_selfsigned_cert_1024.pem

Install does not include client_selfsigned_cert_1024.pem.
OSX Yosemite
node v6.2.2

    throw new Error(" cannot locate certificate file "+options.certificateFile );
    ^

Error: cannot locate certificate file /usr/local/lib/node_modules/opcua-commander/node_modules/node-opcua/certificates/client_selfsigned_cert_1024.pem
at OPCUAClientBase (/usr/local/lib/node_modules/opcua-commander/node_modules/node-opcua/lib/client/client_base.js:68:15)
at new OPCUAClient (/usr/local/lib/node_modules/opcua-commander/node_modules/node-opcua/lib/client/opcua_client.js:71:21)
at Object. (/usr/local/lib/node_modules/opcua-commander/index.js:91:14)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)

Running OPC-UA commander on RaspberryPi

Hello,

I'm running opcua-commander on my RaspberryPI, but I'm having problems. After that I installed opcua-commander, I execute the command "opcua-commander -e opc.tcp://localhost:port" and I got the following error message:

home/pi/opcua-commander/index.js:75
throw new Error("Invalid Security mode , should be " + opcua.MessageSecurityMode.enums.join(" "));
^

Error: Invalid Security mode , should be INVALID NONE SIGN SIGNANDENCRYPT
at Object. (/home/pi/opcua-commander/index.js:75:11)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object. (/home/pi/opcua-commander/bin/opcua-commander:3:1)
at Module._compile (internal/modules/cjs/loader.js:654:30)

After, I adding as argument -s=NONE -P=None and the error change for this:
const client = opcua.OPCUAClient.create({
^

TypeError: opcua.OPCUAClient.create is not a function
at Object. (/home/pi/opcua-commander/index.js:108:34)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)

Could someone help me with this ?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Cannot read property 'join' of undefined

When I run opcua-commander -e opc.tcp://localhost:62541 -u opcuauser -p opcuauser -P=Basic256Sha256 -s SIGNANDENCRYPT I get the error:

C:\dev\npm\node_modules\opcua-commander\index.js:75
    throw new Error("Invalid Security mode , should be " + opcua.MessageSecurityMode.enums.join(" "));
                                                                                           ^

TypeError: Cannot read property 'join' of undefined
    at Object.<anonymous> (C:\dev\npm\node_modules\opcua-commander\index.js:75:92)

I've tried Basic128Rsa15 as well. I'm connecting to a fresh Ignition OPC-UA server and I may not have it configured correctly, however this looks like a bug in opcua-commander unless I have the syntax incorrect.

Node version == 8.15.1

Issue in writing a OPC-Tag/Variable - Invalid variant Boolean value:1

Thank you for this very rapid reaction.
I pulled the latest code base and it does now work out of the box for int and float variables (in my python opcua server environment).
But there is still an issue with writing Boolean type variables, I tried typing several entrie-variants as I sow in your commit that several inputs should be handled.

  1. typed 1 in the write popup, only the numeric character.
$ sudo docker run --network host -it commander -v -e opc.tcp://localhost:4080
Error: Invalid variant arrayType: Scalar  dataType: Boolean value:1 (javascript type = string )
    at constructHook (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:472:19)
    at new Variant (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:112:26)
    at Model.writeNode (/opt/opcuacommander/lib/model/model.ts:311:21)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at Form.<anonymous> (/opt/opcuacommander/lib/view/view.ts:238:23)
  1. typed true in the write popup, the 4 characters.
$ sudo docker run --network host -it commander -v -e opc.tcp://localhost:4080
Error: Invalid variant arrayType: Scalar  dataType: Boolean value:true (javascript type = string )
    at constructHook (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:472:19)
    at new Variant (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:112:26)
    at Model.writeNode (/opt/opcuacommander/lib/model/model.ts:311:21)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at Form.<anonymous> (/opt/opcuacommander/lib/view/view.ts:238:23)
  1. typed "1" in the write popup, the numeric character embedded in quotes, as I was not sure how this entry would be needed.
$ sudo docker run --network host -it commander -v -e opc.tcp://localhost:4080
PKI Folder =  /root/.config/opcua-commander-nodejs/pki
Error: Invalid variant arrayType: Scalar  dataType: Boolean value:"1" (javascript type = string )
    at constructHook (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:472:19)
    at new Variant (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:112:26)
    at Model.writeNode (/opt/opcuacommander/lib/model/model.ts:311:21)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at Form.<anonymous> (/opt/opcuacommander/lib/view/view.ts:238:23)
  1. typed "true" in the write popup, the 4 characters in quotes.
$ sudo docker run --network host -it commander -v -e opc.tcp://localhost:4080
Error: Invalid variant arrayType: Scalar  dataType: Boolean value:"true" (javascript type = string )
    at constructHook (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:472:19)
    at new Variant (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:112:26)
    at Model.writeNode (/opt/opcuacommander/lib/model/model.ts:311:21)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at Form.<anonymous> (/opt/opcuacommander/lib/view/view.ts:238:23)

If I connect the OPCUA server with UA-Expert the Boolean variable is correctly identified and it is possible to tick/untick the box to change the value true/false

Originally posted by @georges-schutz in #35 (comment)

env: node\r: No such file or directory

When I installed this module globally from npm repository,

$ npm install -g opcua-commander

I got this error:

$ opcua-commander
env: node\r: No such file or directory

I found the bin/opcua-commander contains \r (CR) which causes the above error.

$ hexedit opcua-commander
00000000   23 21 2F 75  73 72 2F 62  69 6E 2F 65  6E 76 20 6E  6F 64 65 0D  0A 0D 0A 72  #!/usr/bin/env node....r
00000018   65 71 75 69  72 65 28 22  2E 2E 2F 69  6E 64 65 78  22 29 3B 0D  0A           equire("../index");..

I am using macbook pro with node v6.9.0. Installed opcua-commander has version 0.1.7 (gitHead: 456835a)

This error does not happen if you do git-clone first, probably because it removes CR automatically while cloning...

Connection with SecurityPolicy != None

Would it be possible to get some information how to connect to OPC UA Server with Security Policy Basic256, Basic128Rsa15 or Basic256Sha256 ?
I do not really understand the folder hierarchy for the Certificate and Private key...
Where are the required Certificate ? Private key ?

The one specified in the index.js do not match....

const certificateFile = path.join(__dirname,"certificates","client_cert_2048.pem");
const privateKeyFile = path.join(__dirname,"certificates","PKI/own/private/private_key.pem" );

Error: Cannot find module 'xml-writer'

After installing opcua-commander got the following while trying to start it:

`[root@monitor bin]# opcua-commander
internal/modules/cjs/loader.js:984
throw err;
^

Error: Cannot find module 'xml-writer'
Require stack:

  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-xml2json/dist/source/fragmentCloner.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-xml2json/dist/source/index.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-schemas/dist/source/parse_binary_xsd.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-schemas/dist/source/index.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client-dynamic-extension-object/dist/client_dynamic_extension_object.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client-dynamic-extension-object/dist/index.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client/dist/private/client_session_impl.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client/dist/private/opcua_client_impl.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client/dist/opcua_client.js
  • /usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client/dist/index.js
  • /usr/lib/node_modules/opcua-commander/index.js
  • /usr/lib/node_modules/opcua-commander/bin/opcua-commander
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:981:15)
    at Function.Module._load (internal/modules/cjs/loader.js:863:27)
    at Module.require (internal/modules/cjs/loader.js:1043:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object. (/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-xml2json/dist/source/fragmentCloner.js:3:19)
    at Module._compile (internal/modules/cjs/loader.js:1157:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
    at Module.load (internal/modules/cjs/loader.js:1001:32)
    at Function.Module._load (internal/modules/cjs/loader.js:900:14)
    at Module.require (internal/modules/cjs/loader.js:1043:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-xml2json/dist/source/fragmentCloner.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-xml2json/dist/source/index.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-schemas/dist/source/parse_binary_xsd.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-schemas/dist/source/index.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client-dynamic-extension-object/dist/client_dynamic_extension_object.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client-dynamic-extension-object/dist/index.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client/dist/private/client_session_impl.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client/dist/private/opcua_client_impl.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client/dist/opcua_client.js',
    '/usr/lib/node_modules/opcua-commander/node_modules/node-opcua-client/dist/index.js',
    '/usr/lib/node_modules/opcua-commander/index.js',
    '/usr/lib/node_modules/opcua-commander/bin/opcua-commander'
    ]
    }
    `

I've installed the xml-writer

Cannot find ANONYMOUS user token policy in end point description

Hi

when I run this OPC-UA sample server https://github.com/locka99/opcua/tree/master/samples/simple-server

Then then try to open the Commander on it, I get this error:

Cannot create session Error: Cannot find ANONYMOUS user token policy in end point description

As described in node-opcua/node-opcua#693 I ran the get_endpoint gist, and here is the output of it:

securityMode        =  1
securityPolicy      =  http://opcfoundation.org/UA/SecurityPolicy#None
05:55:28.255Z :opcua_client_impl             :342   Warning: endpoint_must_exist is now deprecated, use endpointMustExist instead
 connecting to  opc.tcp://127.0.0.1:4855
    strategy {
  initialDelay: 2000,
  maxDelay: 10000,
  maxRetry: 10,
  randomisationFactor: 0
}
endpoint                           Application URI           Product URI                       Application Name      securityLevel  Security Mode   securityPolicyUri                                                 Type    certificate  discoveryUrls
---------------------------------  ------------------------  --------------------------------  --------------------  -------------  --------------  ----------------------------------------------------------------  ------  -----------  -------------------------
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  2              Sign            http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep  Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  12             SignAndEncrypt  http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep  Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  5              Sign            http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss   Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  15             SignAndEncrypt  http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss   Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  1              Sign            http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15          Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  11             SignAndEncrypt  http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15          Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  3              Sign            http://opcfoundation.org/UA/SecurityPolicy#Basic256               Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  13             SignAndEncrypt  http://opcfoundation.org/UA/SecurityPolicy#Basic256               Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  4              Sign            http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256         Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  14             SignAndEncrypt  http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256         Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/noaccess  urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  0              None            http://opcfoundation.org/UA/SecurityPolicy#None                   Server  ...          opc.tcp://127.0.0.1:4855/
opc.tcp://127.0.0.1:4855/          urn:OPC UA Sample Server  urn:OPC UA Sample Server Testkit  OPC UA Sample Server  0              None            http://opcfoundation.org/UA/SecurityPolicy#None                   Server  ...          opc.tcp://127.0.0.1:4855/

Identify Token for : Security Mode= Sign  Policy= http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep
policyId           tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-----------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous          0          null             null               null
userpass_rsa_oaep  1          null             null               null
x509               2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= SignAndEncrypt  Policy= http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep
policyId           tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-----------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous          0          null             null               null
userpass_rsa_oaep  1          null             null               null
x509               2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= Sign  Policy= http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss
policyId           tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-----------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous          0          null             null               null
userpass_rsa_oaep  1          null             null               null
x509               2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= SignAndEncrypt  Policy= http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss
policyId           tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-----------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous          0          null             null               null
userpass_rsa_oaep  1          null             null               null
x509               2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= Sign  Policy= http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15
policyId         tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
---------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous        0          null             null               null
userpass_rsa_15  1          null             null               null
x509             2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= SignAndEncrypt  Policy= http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15
policyId         tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
---------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous        0          null             null               null
userpass_rsa_15  1          null             null               null
x509             2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= Sign  Policy= http://opcfoundation.org/UA/SecurityPolicy#Basic256
policyId           tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-----------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous          0          null             null               null
userpass_rsa_oaep  1          null             null               null
x509               2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= SignAndEncrypt  Policy= http://opcfoundation.org/UA/SecurityPolicy#Basic256
policyId           tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-----------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous          0          null             null               null
userpass_rsa_oaep  1          null             null               null
x509               2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= Sign  Policy= http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
policyId           tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-----------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous          0          null             null               null
userpass_rsa_oaep  1          null             null               null
x509               2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= SignAndEncrypt  Policy= http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
policyId           tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-----------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous          0          null             null               null
userpass_rsa_oaep  1          null             null               null
x509               2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

Identify Token for : Security Mode= None  Policy= http://opcfoundation.org/UA/SecurityPolicy#None



Identify Token for : Security Mode= None  Policy= http://opcfoundation.org/UA/SecurityPolicy#None
policyId       tokenType  issuedTokenType  issuerEndpointUrl  securityPolicyUri
-------------  ---------  ---------------  -----------------  --------------------------------------------------------
anonymous      0          null             null               null
userpass_none  1          null             null               null
x509           2          null             null               http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15

success !!

Any idea why this happens?

Unmonitor items

I can't seem to unmonitor an item. When the item monitored is selected in the tree and i press u, nothing happens. I also can't change the selection to monitored items, only to Address Space (tree) and Attribute list.

Can not run on Ubuntu with Nodejs 6.14

I have Ubuntu 16.04, with node 6.14. I get the following error while starting:

ubuntu@ip-172-31-16-24:~$ opcua-commander -e opc.tcp://localhost:26543
/usr/bin/env: ‘node\r’: No such file or directory

Here is my environment:

ubuntu@ip-172-31-16-24:~$ which node
/usr/bin/node
ubuntu@ip-172-31-16-24:~$ ll /usr/bin/node*
-rwxr-xr-x 1 root root 30726190 Aug 15 13:15 /usr/bin/node*
lrwxrwxrwx 1 root root       24 Aug 20 09:56 /usr/bin/nodejs -> /etc/alternatives/nodejs*
lrwxrwxrwx 1 root root       13 Aug 20 09:59 /usr/bin/nodejs6.10 -> /usr/bin/node*
ubuntu@ip-172-31-16-24:~$ node -v
v6.14.4
ubuntu@ip-172-31-16-24:~$ uname -a
Linux ip-172-31-16-24 4.4.0-1066-aws #76-Ubuntu SMP Thu Aug 16 16:21:21 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

I can go to the installation folder and run with node command to connect to the locally running node-opcua, but it closes immediately:

root@ip-172-31-16-24:/usr/lib/node_modules/opcua-commander# pwd
/usr/lib/node_modules/opcua-commander
root@ip-172-31-16-24:/usr/lib/node_modules/opcua-commander# node index.js  -e opc.tcp://localhost:26543

Issue in writing a OPC-Tag/Variable - wrong ValueType

Hi all, I am new to github and opcua-commander but not new to opcua.
First thank you to have written such a useful client, I use it in case of remote ssh server connection where only a shell is available.
Especially the docker container integration is really handy as on that server I need to avoid modifying OS packages but docker is available.

For browsing and reading OPC variables this works grate and fast and is very convenient.
As an input I needed to change the docker command a little to make it work due to networking aspects in docker.
docker run --network host -it commander -e opc.tcp://localhost:4080

But the writing to a variable seem to be buggy. It is working but it destroys the ValueType/VariantType so that the variable is not usable any more after writing with opcua-commander. If I write with another client (python GUI FreeOpcUa Client or any own python scripts I can re-write the tag and the value is OK again also in the opcua-commander.

I am not a node-js programmer, but I looked up the code and I think the write issue may come from somewhere in
opcua-commander/lib/model/model.ts in the writeNode() function at least it is where the WriteValue() method from node-opcua-client lib is used and where also the Variant() value is created.
Is this it possible that this code line value.dataType = dataType.text.split(" ")[0]; results in a wrong representation of the dataType to use here?

As a test environment I use a simple python opcua server. But I can also use other professional OPCUA servers on some production sides.

Can not connect to opc ua plc using opcua-commander

When I run opc plc server using Docker

docker pull mcr.microsoft.com/iotedge/opc-plc:<See version.json>
docker run --rm -it -p 50000:50000 -p 8080:8080 --name opcplc mcr.microsoft.com/iotedge/opc-plc:latest --pn=50000
--autoaccept --sph --sn=5 --sr=10 --st=uint --fn=5 --fr=1 --ft=uint --gn=5

And can not use opcua-commander to connect it.

My OPC PLC Server in Docker
image

OPCUA Commander
image

Naming conflict with OpenShift CLI (oc)

I tried installing opcua-commander with npm install opcua-commander -g and it failed due to a naming conflict with OpenShift CLI.

npm notice Run npm install -g [email protected] to update!
npm notice 
npm ERR! code EEXIST
npm ERR! path /usr/local/bin/oc
npm ERR! EEXIST: file already exists
npm ERR! File exists: /usr/local/bin/oc
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

I would be fine with running opcua-commander as is and don't need the supposedly shortened symlink created in /usr/local/bin but I am unsure how to adapt the installation process. Any ideas on that?

Also I do not wish to overwrite the symlink for the Openshift CLI as I use it more often than opcua-commander.

Docker image is broken

Hi I've tried building the docker image for the latest release (0.31) but it fails to build.

I've run git bisect on the repo and it seems that the break was introduced in 1812e9b

Here's the log I'm getting building the image

> docker build . -t opcua-commander
[+] Building 7.0s (12/12) FINISHED                                                                         docker:inferencedb
 => [internal] load .dockerignore                                                                                        0.0s
 => => transferring context: 66B                                                                                         0.0s
 => [internal] load build definition from Dockerfile                                                                     0.0s
 => => transferring dockerfile: 884B                                                                                     0.0s
 => [internal] load metadata for docker.io/library/node:alpine3.10                                                       0.5s
 => [1/8] FROM docker.io/library/node:alpine3.10@sha256:c392d12c89f7345dfa7192162bc0edc84f29278d2002b6df0db131428474803  0.0s
 => [internal] load build context                                                                                        0.0s
 => => transferring context: 7.31kB                                                                                      0.0s
 => CACHED [2/8] RUN apk add openssl dos2unix                                                                            0.0s
 => CACHED [3/8] WORKDIR /opt/opcuacommander                                                                             0.0s
 => [4/8] COPY . .                                                                                                       0.1s
 => [5/8] COPY package*.json ./                                                                                          0.1s
 => [6/8] RUN dos2unix bin/opcua-commander                                                                               0.4s
 => [7/8] RUN npm config set registry http://registry.npmjs.org/ && npm ci --only=production --unsafe-perm=true --allow  3.4s
 => ERROR [8/8] RUN npm install -g typescript && npm run build                                                           2.5s
------
 > [8/8] RUN npm install -g typescript && npm run build:
1.115 npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
1.157 npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
1.420
1.420 added 1 package in 968ms
1.530
1.530 > [email protected] build
1.530 > tsc -b && npm run bundle
1.530
2.441 lib/widget/widget_tree.ts(3,25): error TS7016: Could not find a declaration file for module 'blessed'. '/opt/opcuacommander/node_modules/blessed/lib/blessed.js' implicitly has an 'any' type.
2.441   Try `npm i --save-dev @types/blessed` if it exists or add a new declaration (.d.ts) file containing `declare module 'blessed';`
2.442 lib/view/alarm_box.ts(1,25): error TS7016: Could not find a declaration file for module 'blessed'. '/opt/opcuacommander/node_modules/blessed/lib/blessed.js' implicitly has an 'any' type.
2.442   Try `npm i --save-dev @types/blessed` if it exists or add a new declaration (.d.ts) file containing `declare module 'blessed';`
2.442 lib/view/alarm_box.ts(3,18): error TS7016: Could not find a declaration file for module 'wordwrap'. '/opt/opcuacommander/node_modules/wordwrap/index.js' implicitly has an 'any' type.
2.442   Try `npm i --save-dev @types/wordwrap` if it exists or add a new declaration (.d.ts) file containing `declare module 'wordwrap';`
2.442 lib/view/view.ts(1,26): error TS7016: Could not find a declaration file for module 'blessed'. '/opt/opcuacommander/node_modules/blessed/lib/blessed.js' implicitly has an 'any' type.
2.442   Try `npm i --save-dev @types/blessed` if it exists or add a new declaration (.d.ts) file containing `declare module 'blessed';`
2.442 lib/view/main_menu.ts(1,26): error TS7016: Could not find a declaration file for module 'blessed'. '/opt/opcuacommander/node_modules/blessed/lib/blessed.js' implicitly has an 'any' type.
2.442   Try `npm i --save-dev @types/blessed` if it exists or add a new declaration (.d.ts) file containing `declare module 'blessed';`
------
Dockerfile:21
--------------------
  19 |     RUN npm config set registry http://registry.npmjs.org/ && npm ci --only=production --unsafe-perm=true --allow-root
  20 |     # Install typescript and build solution
  21 | >>> RUN npm install -g typescript && npm run build
  22 |
  23 |     ENTRYPOINT [ "./bin/opcua-commander" ]
--------------------
ERROR: failed to solve: process "/bin/sh -c npm install -g typescript && npm run build" did not complete successfully: exit code: 1

Issue in writing a OPC-Tag/Variable - dimension can only provided if variant is a matrix

Hi all and thank you for the fix.
I have pulled the 0.18.0 code base and rebuild the docker container.
I have tested the same write action and this does produce the following exception

Error: dimension can only provided if variant is a matrix
    at assert (/opt/opcuacommander/node_modules/node-opcua-assert/source/index.ts:12:21)
    at constructHook (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:486:15)
    at new Variant (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:112:26)
    at Model.writeNode (/opt/opcuacommander/lib/model/model.ts:311:21)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at Form.<anonymous> (/opt/opcuacommander/lib/view/view.ts:238:23)

Base on that and my previous research, I have just removed the dimension property at Variant creation.

diff --git a/lib/model/model.ts b/lib/model/model.ts
@@ -311,7 +311,7 @@ export class Model extends EventEmitter {
       const value = new Variant({
         dataType,
         arrayType: valueRank === -1 ? VariantArrayType.Scalar : valueRank === 1 ? VariantArrayType.Array : VariantArrayType.Matrix,
-        dimensions: arrayDimension,
+//        dimensions: arrayDimension,
         value: data,
       });
       const writeValue = new WriteValue({

With that I am back to be able to just write scalar opc-variables.
The error in writing Boolean types is still present.

Error: Invalid variant arrayType: Scalar  dataType: Boolean value:1 (javascript type = string )
    at constructHook (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:472:19)
    at new Variant (/opt/opcuacommander/node_modules/node-opcua-variant/source/variant.ts:112:26)
    at Model.writeNode (/opt/opcuacommander/lib/model/model.ts:311:21)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at Form.<anonymous> (/opt/opcuacommander/lib/view/view.ts:238:23)

Originally posted by @georges-schutz in #33 (comment)

Variable structure crashes commander

Dear Etienne,

I tried to read an OPC UA Variable with structure and it crashes the commander every time.
I know it is not UAExpert, but there it works well. It would be great if the commander will support such Variable structures.

image

image

image

Thank you for your time!
Happy coding!
Klaus

Seeing a Back off error

Attached is an image of the error I am seeing when I run my OPC connection.

I am connecting using Security= None.
I made the necessary changes to two files (packages/node-opcua-client/src/opcua_client.js and packages/node-opcua-secure-channel/src/security_policy.js) based on this issue:
Updated:
https://github.com/node-opcua/node-opcua/pull/451/files#diff-071a8e480403d352c67d8d127f6c9e4e

Once these changes were made, I built out my certificate and ran npm install.
Next I started the OPC Server and saw the following:

opc cli issue

I am running Node V9.0.0, npm V5.5.1

Do you have any idea why the final step in the connection is not going through? This exact process was working for me a few months ago.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Doesn't Start

After installing it, I am trying to run opcua-commander, it says:

/usr/local/lib/node_modules/opcua-commander/dist/model/model.js:112
    client;
          ^

SyntaxError: Unexpected token ;
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/opcua-commander/lib/index.ts:4:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.