-
-
Save simonbowen/033e600832a27664cdb8d6225ef5ef5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { OPCUAClient, AttributeIds } from "node-opcua"; | |
const endpoint = "opc.tcp://192.168.100.64:4840"; | |
const PITCH_NODE = "ns=6;s=::CuttingLab:DataExchange.Cfg.Cutting.Pitch"; | |
(async () => { | |
try { | |
const client = OPCUAClient.create({ | |
endpoint_must_exist: false, | |
connectionStrategy: { | |
maxRetry: 2, | |
initialDelay: 2000, | |
maxDelay: 10 * 1000 | |
} | |
}); | |
await client.connect(endpoint); | |
const session = await client.createSession({ userName: 'XXXXXX', password: 'XXXXXX' }); | |
const pitch = await session.read({ | |
nodeId: PITCH_NODE, | |
attributeId: AttributeIds.Value, | |
}); | |
console.log(pitch); | |
} catch (err) { | |
console.log(err); | |
} | |
})(); |
erossignon
commented
Apr 8, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment