This site uses cookies for functional purposes. To continue please read and agree to our Data Privacy.

By closing this message, you consent to our use of cookies on this device.

Automation Maker #003: Node-RED as OPC UA client

More information on the IIoT OPC UA node package:

Command to install the IIoT OPC UA node package:

npm install -g node-red-contrib-iiot-opcua

Thank you to PLCnext Community members David Petter and Stefan Brinkmann, and to Klaus Landsdorf from Bianco Royal, for their valuable contributions.

Note: We show the engineering part in this video using a beta version of the upcoming PLCnext Engineer software by Phoenix Contact that will be available soon and for free. Until then, the procedure should work using the current PC Worx Engineer version as well. If you encounter any problems, please let us know.

The flow used in this example is represented by the following JSON (press "Read more" to see it). It can be imported straight into the editor by pasting the JSON into the Import dialog (Ctrl-I or via the dropdown menu).

[{"id":"e141b7d8.bc3b48","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"8fdc7c33.e834b","type":"OPCUA-IIoT-Inject","z":"e141b7d8.bc3b48","injectType":"read","payload":"","payloadType":"date","topic":"","repeat":"","crontab":"","once":false,"startDelay":"","name":"","addressSpaceItems":[{"name":"xLamp","nodeId":"ns=5;s=Arp.Plc.Eclr/MainInstance.xLamp","datatypeName":""}],"x":340,"y":180,"wires":[["3e319cb3.7455c4"]]},{"id":"3e319cb3.7455c4","type":"OPCUA-IIoT-Read","z":"e141b7d8.bc3b48","attributeId":"13","maxAge":1,"depth":1,"connector":"cf1e3cc8.52bf9","name":"Look at Lamp","justValue":true,"showStatusActivities":false,"showErrors":false,"parseStrings":false,"historyDays":"","x":520,"y":180,"wires":[["1bb83854.053ec8"]]},{"id":"1bb83854.053ec8","type":"OPCUA-IIoT-Response","z":"e141b7d8.bc3b48","name":"","compressStructure":true,"showStatusActivities":false,"showErrors":false,"activateUnsetFilter":false,"activateFilters":false,"negateFilter":false,"filters":[],"x":730,"y":180,"wires":[["f5cb5c8.f59b9a"]]},{"id":"f5cb5c8.f59b9a","type":"debug","z":"e141b7d8.bc3b48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":180,"wires":[]},{"id":"d0355d07.c6662","type":"OPCUA-IIoT-Inject","z":"e141b7d8.bc3b48","injectType":"write","payload":"false","payloadType":"bool","topic":"","repeat":"","crontab":"","once":false,"startDelay":"","name":"","addressSpaceItems":[{"name":"xSwitch","nodeId":"ns=5;s=Arp.Plc.Eclr/MainInstance.xSwitch","datatypeName":"Boolean"}],"x":330,"y":320,"wires":[["159289c0.5c8e46"]]},{"id":"159289c0.5c8e46","type":"OPCUA-IIoT-Write","z":"e141b7d8.bc3b48","connector":"cf1e3cc8.52bf9","name":"Throw Switch","justValue":true,"showStatusActivities":false,"showErrors":true,"x":520,"y":320,"wires":[["82688db6.7b026"]]},{"id":"82688db6.7b026","type":"OPCUA-IIoT-Response","z":"e141b7d8.bc3b48","name":"","compressStructure":false,"showStatusActivities":false,"showErrors":false,"activateUnsetFilter":false,"activateFilters":false,"negateFilter":false,"filters":[],"x":720,"y":320,"wires":[["c9854ebd.347d8"]]},{"id":"c9854ebd.347d8","type":"debug","z":"e141b7d8.bc3b48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":320,"wires":[]},{"id":"f602fe92.b748a","type":"OPCUA-IIoT-Inject","z":"e141b7d8.bc3b48","injectType":"write","payload":"true","payloadType":"bool","topic":"","repeat":"","crontab":"","once":false,"startDelay":"","name":"","addressSpaceItems":[{"name":"xSwitch","nodeId":"ns=5;s=Arp.Plc.Eclr/MainInstance.xSwitch","datatypeName":"Boolean"}],"x":330,"y":380,"wires":[["159289c0.5c8e46"]]},{"id":"cf1e3cc8.52bf9","type":"OPCUA-IIoT-Connector","z":"","discoveryUrl":"","endpoint":"opc.tcp://192.168.1.10:4840","keepSessionAlive":true,"loginEnabled":true,"securityPolicy":"Basic256Sha256","securityMode":"SIGNANDENCRYPT","name":"LOCAL SERVER","showErrors":false,"individualCerts":false,"publicCertificateFile":"","privateKeyFile":"","defaultSecureTokenLifetime":"","endpointMustExist":false,"autoSelectRightEndpoint":false,"strategyMaxRetry":"","strategyInitialDelay":"","strategyMaxDelay":"","strategyRandomisationFactor":"","requestedSessionTimeout":"","connectionStartDelay":"","reconnectDelay":"","maxBadSessionRequests":"10"}]

We have 209 guests and no members online