To be able to follow this blog, you must have alreday installe the OPC-UA inside Node-Red.
Then, it will be possible to send a mail, with a command from the PLC (xSend) including a variable message (strText).
Here are the 2 variables of the AXC F 2152 which will be used and accessible by OPC UA :
OPC option must be checked.
In the Node-Red flow, insert this code :
The ‘debug’ output are just for help.
First, you need to access to the OPC variables, and scan each 5 seconds their value.
Wait for the OPC UA server responses :
To get the value of xSend
If xSend = True, extract the strText
Then send the message to a defined mail adress :
Of course, you have to adapt the name of the server, mail adress, etc…
Then, you will just need to define the text to send in strText in the AXC F 2152 and set xSend to TRUE.
It is of course necessary to reset xSend. For this, the second part of the flow is used :
Cyclically, set xSend to FALSE :
Send the value to the OPC UA server :
permit to control the write process.
permits to send the mail from Node-Red, for test, for example. It sets xSend to TRUE.
Here is the code of the flow for firmware v1.x (click the triangle).With the new firmware version 2019.0, it is now impossible to write a value from node-Red to an OPC UA OutPort.So, here is a new flow using xSend and xSent as variables to send the mail and to inform the AXC F 2152 that the mail has been sent (click the triangle).
Leave a Reply
You must be logged in to post a comment.