mikakaraila / node-red-contrib-opcua

A Node-RED node to communicate OPC UA. Uses node-opcua library.
Other
216 stars 197 forks source link

passing the ServerIP over msg.-Object #736

Closed robotsox closed 1 month ago

robotsox commented 1 month ago

Can you implate that we can send over the msg.-object the opc-ua server ip/host and the port number? Thanks!

mikakaraila commented 1 month ago

It's already implemented for the client. You can specify endpoint parameters

On Thu, Oct 3, 2024, 15:44 robotsox @.***> wrote:

Can you implate that we can send over the msg.-object the opc-ua server ip/host and the port number? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/mikakaraila/node-red-contrib-opcua/issues/736, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRYDHP4CDGRHUHBOUP2PTZZU33BAVCNFSM6AAAAABPJWZ4KOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU3DGOJWHAYTAOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

robotsox commented 1 month ago

ok, how it works? which message object is it?

robotsox commented 1 month ago

grafik

i tried to send a object "msg.endpoint" with the value ""opc.tcp://172.30.0.1:48400" but the node "OpcUa-Client" ignore it and use the preconfigured connection and not the dynamic value from the message object.

mikakaraila commented 1 month ago

Did you look my examples? OPCUA-TEST-NODES.json

robotsox commented 1 month ago

i tried your example flow with the following message objects:

msg.action = 'connect';
    msg.OpcUaEndpoint = {
        credentials: {
            user: "myuser",
            password: "**********" 
        },
        endpoint: 'opc.tcp://172.30.0.1:48400',
        securityPolicy: 'None',
        securityMode: 'None',
        login: true 
    }

this object i send to a OPC-UA-Client Node with "Read Multiple", but the settings from the message object are not accepted. The OPC-UA-CLient Node try only the Endpoint what is manually configured in the OPC-UA-CLient Settings.

The error text on the Client-Node say: "invalid endpoint"

Client node error on: Read all 10s error: ["Wrong endpoint parameters: {\"id\":\"33099f306f869103\",\"type\":\"OpcUa-Endpoint\",\"_closeCallbacks\":[],\"_inputCallback\":null,\"_inputCallbacks\":null,\"_expectedDoneCount\":0,\"wires\":[],\"_wireCount\":0,\"credentials\":{\"user\":\"myuser\",\"password\":\"**********\"},\"endpoint\":\"0.0.0.0\",\"securityPolicy\":\"None\",\"securityMode\":\"None\",\"login\":false,\"none\":false,\"usercert\":false,\"userCertificate\":\"\",\"userPrivatekey\":\"\",\"user\":\"myuser\",\"password\":\"*******\"}"]
mikakaraila commented 1 month ago

There is something that is not anymore working, can be caused some refactoring/merge... investigating.

robotsox commented 1 month ago

Thanks! :)

mikakaraila commented 1 month ago

Found it!

robotsox commented 1 month ago

Thanks :)