How can I change value from a node when having a server instance (node-opcua)

Astrowie

I'm using node-opcua library. I have instance of OPCUAServer. How can I get node value and edit it?

I assume OPC client should be able to do it, but I want to interact with OPC server since I'm responding to an internal event.

Should I maybe use something like WriteRequest to perform such operation?

Etienne

alternatively you can use the setValueFromSource method on the variable. This will bypass all Read/Write access checking that takes place in writeValue. It is also synchronous

nodeToChange.setValueFromSource({ dataType: "Double", value: 3.14});

setValueFromSource can take an optional statusCode

nodeToChange.setValueFromSource(
     { dataType: "Double", value: 3.14}, 
     opcua.StatusCodes.BadWaitingForInitialData
);

if not specified StatusCodes.Good is assumed.

and a optional source timestamp

nodeToChange.setValueFromSource(
    { dataType: "Double", value: 3.14},
     opcua.StatusCodes.Good, new Date());

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Should/Can you run Node-OPCUA Server running on Azure?

Remove variable dynamically from node-opcua server

How to get connected clients and client certificate in node-opcua server

Creating instance of custom opcua object type node

Node / Express / EJS: How can I get value from index.ejs and pass it to server.js

How can I change the border color of a node from it's XPath?

How can I redirect a page from an external Node/Express server

From node how can I check if a remote server is running ssh?

How can I return a value from a parent function in Node?

How can I extract these key/value pairs from this JSON node?

how can i get node Element value From LINQ?

How can I change selected value of a DropDownList with having change method?

How to select a specific node from XDocument having a specific attribute value?

How can I change the value of a variable when referring it from an array?

How to use node-opcua Subscription priority?

How to import node-opcua to project?

How to add role permissions to a node in OPCFoundation OPCUA

Eclipse milo - OPCUA - What is the best practice to inform server (value/node) changes to the client to trigger a refresh?

XSLT - How can I copy parent node when inside loop from a variable node using streaming?

How can I access value of particular node

How can i connect to a meteor.js mongodb instance from a diffrent node.js proccess

Require node-opcua in electron freezes the electron instance

nodejs-How use node-opcua access a remote opc server?

How to trust a self-signed server certificate with the node-opcua client

How can I change the value of process.env.PORT in node.js? (Solved)

How can i change the value of a variable inside a function in node.js?

Input stops working when I change value (Node.js)

Using Mockito, how can I mock a return value of an instance method without having an instance of that class?

How can I set the value of instance from another instance?