这就是我试图创造的,这对我来说是全新的。我希望有一个人可以帮助我。
//this is the part I cannot figure out, maby anyone knows a tool how to find this port
const endpointUrl = "opc.tcp://145.49.49.3:???";
const opcua = require("node-opcua");
const AttributeIds = opcua.AttributeIds;
const OPCUAClient = opcua.OPCUAClient;
(async function main(){
const client = new OPCUAClient({});
await client.connect(endpointUrl);
const session = await client.createSession({userName: "admin", password: ""});
const dataValue = await session.read({nodeId: "ns=1;s=AcquisitionCount",attributeId: AttributeIds.Value});
console.log(`Count is ${dataValue.value.value.toPrecision(3)}°C.`);
await client.closeSession(session,true);
await client.disconnect();
})();
饮歌长啸
相关分类