Send values in a message
The dialog of the Endpoint Control node holds the server and the login. A message can change these values, and more, while the flow runs.
The properties of the message
| Property | Type | Use |
|---|---|---|
msg.action | string | connect, disconnect, reset, get, validate or status |
msg.config | object | the values to change (Connect and Check only) |
msg.mode | string | merge (the default) or replace. See Advanced settings |
msg.ifRevision | number | Connect, Check and Reset. See Advanced settings |
- The node reads
msg.actiononly when the Action is "Let the message decide". - Reset, Disconnect, Get the settings and Get the status use no value of
msg.config. A message for one of them with amsg.configthat is not empty gets an error message onconfig. The node then does nothing. - An empty
msg.config({},nullor"") counts as nomsg.config. A flow can attach one to every message. - A Reset with
msg.modegets an error message onmode. A reset always uses all the endpoint settings again.
The fields of msg.config
The fields have the names of the fields of the OpcUa-Endpoint2 node.
| Field | Value |
|---|---|
endpoint | the server address: opc.tcp://host:port/path |
securityMode | None, Sign or SignAndEncrypt |
securityPolicy | for example Basic256Sha256 |
userIdentityType | the login: Anonymous, UserName or Certificate |
userName, password | for UserName |
userCertificate, userPrivatekey, userPrivatekeyPassphrase | for Certificate, as PEM text. See The password and the certificate |
maxRetry, initialDelay, maxDelay | integers. See Advanced settings |
namespaceAliases | the alias table. See Advanced settings |
subscriptions | some parameters of the subscriptions. See Advanced settings |
A field that is not in this list gets an error message on that field. Some settings never change by a message: see Safety.
Example
msg.action = "connect";
msg.config = {
endpoint: "opc.tcp://line-b:4840",
securityMode: "SignAndEncrypt",
securityPolicy: "Basic256Sha256",
userIdentityType: "UserName",
userName: "operator",
password: "secret"
};
return msg;
A value in the message replaces the value in the dialog
For Connect, Check and Let the message decide, the node makes one set of values from the dialog and the message.
- A value in
msg.configreplaces the value in the dialog. - A value in the dialog replaces the value in use.
- When neither has a value, the node keeps the value in use (mode
merge), or uses the value of the endpoint (modereplace).
A blank value ("" or null) counts as no value.
| Field | Rule |
|---|---|
endpoint, securityMode, securityPolicy | the rule above |
| the login fields | see "The login is one group" below |
maxRetry, initialDelay, maxDelay | one by one: the message, then the value in use or the value of the endpoint |
namespaceAliases | the table of the message as a whole, else the table in use or the table of the endpoint |
subscriptions | by id, parameter by parameter: the message, then the value in use or the value of the endpoint |
mode | msg.mode, else merge |
ifRevision | msg.ifRevision only |
The node checks the result as it checks a message that carries all of it. The order is:
- the licence, for Connect and Reset only. The node checks it before it reads the values.
- the checks of the values:
msg.mode,msg.ifRevision, then the fields. - Allowed servers, on the server address that results (the address of the dialog included).
- the server: it must accept a TCP connection. Then the node asks the server for its list of connection options (GetEndpoints). For Connect, no answer to GetEndpoints gives only a warning.
- the switch, with a time limit. After a failure, the node uses the previous settings again.
The first step that fails stops the action. Check runs the steps 2 to 4 and changes nothing. It gives the result that Connect gives for the same values.
A Connect with no value, neither in the message nor in the dialog, connects again with the settings in use.
The login is one group
The login fields are userIdentityType, userName, password, userCertificate, userPrivatekey and userPrivatekeyPassphrase.
- If the message carries
userIdentityType, the login of the message replaces the login of the dialog as a whole. The user name of the dialog is not used. - If the message carries only secrets, they complete the login of the dialog. The dialog gives the type and the user name.
- If neither the message nor the dialog gives
userIdentityType, a message with a login field gets an error message onuserIdentityType. - The new login replaces the whole old login. The node deletes the old password when the login changes to another type.
- A field that does not belong to the type gets an error message on that field. Example: a
passwordwithAnonymous. - A blank field (
""ornull, as a form sends it) that does not belong to the type counts as absent. - A blank
userName,password,userCertificateoruserPrivatekeyof the chosen type gets an error message. - A blank
endpoint,securityMode,securityPolicyor retry field counts as absent. - When the server address changes to another host or port, the message must carry
userIdentityType. The node does not keep the old login for a new server.
Let the message decide
With the Action "Let the message decide", the node reads the action from a property of the message. The default property is msg.action. You can set another name in the text field of the Action, for example payload.command.
- The value must be one of
connect,disconnect,reset,get,validateandstatus. The match is exact, in lower case. - A missing value, or another value, gets an error message on
action. It lists the valid values.
With any other Action, the node ignores msg.action. The first message with another msg.action gets a warning in the log of the node, once.