UNPKG

node-red-contrib-cip-st-ethernet-ip

Version:

A Node-RED node to interact with Allen Bradley / Rockwell PLCs using the EtherNet/IP Protocol

165 lines (154 loc) 6.94 kB
<!-- Copyright: (c) 2016-2020, ST-One Ltda., Guilherme Francescon Cittolin <guilherme@st-one.io> GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) --> <script type="text/html" data-help-name="eth-ip endpoint"> <p>Represents a PLC connection</p> <p>This node was created as part of the <a href="https://st-one.io" target="_blank">ST-One</a> project</p> </script> <script type="text/html" data-help-name="eth-ip in"> <p>Reads data from a PLC</p> <p>This node was created as part of the <a href="https://st-one.io" target="_blank">ST-One</a> project</p> <h3 id="output-desc">Outputs</h3> <p>If <b>Group metric data</b> is unchecked</p> <dl class="message-properties"> <dt>payload <span class="property-type">any</span></dt> <dd> The value(s) as read from the PLC </dd> <dt>topic<span class="property-type">string</span></dt> <dd> The name of the variable (or mapping), when the message refers to a single variable (that is, when mode is "Single Variable" or "All variables, one per message") </dd> <dt>lastValue<span class="property-type">any</span></dt> <dd> Previous data read from the PLC </dd> <dt>timestamp<span class="property-type">timestamp</span></dt> <dd> Timestamp when value was retrieved (Only when <b>Include timestamp</b> is checked). </dd> </dl> <p>If <b>Group metric data</b> is checked</p> <dl class="message-properties"> <dt>payload<span class="property-type">object</span></dt> <dd> Object containing return data </dd> <dt>payload.value<span class="property-type">any</span></dt> <dd> The value(s) as read from the PLC </dd> <dt>payload.topic<span class="property-type">string</span></dt> <dd> The name of the variable (or mapping), when the message refers to a single variable (that is, when mode is "Single Variable" or "All variables, one per message") </dd> <dt>payload.lastValue<span class="property-type">any</span></dt> <dd> Previous data read from the PLC </dd> <dt>payload.timestamp<span class="property-type">timestamp</span></dt> <dd> Timestamp when value was retrieved (Only when <b>Include timestamp</b> is checked). </dd> </dl> <p>If <b>Add error output</b> is checked</p> <p> An extra output is created on the node. This output contains errors from the node (as of writing only unknown tags is sent on this output). </p> <p>If <b>Group metric data</b> is unchecked</p> <dl class="message-properties"> <p>Only on 2. (error) output:</p> <dt>error<span class="property-type">string</span></dt> <dd> Error description. </dd> <dt>tag<span class="property-type">string</span></dt> <dd> The name of the problematic variable on PLC. </dd> <dt>topic<span class="property-type">string</span></dt> <dd> The name of the problematic mapping (or tag) on PLC. </dd> <dt>timestamp<span class="property-type">timestamp</span></dt> <dd> Timestamp when error occurred. (Only when <b>Include timestamp</b> is checked). </dd> </dl> <p>If <b>Group metric data</b> is checked</p> <dl class="message-properties"> <p>Only on 2. (error) output:</p> <dt>error<span class="property-type">object</span></dt> <dd> Object containing error data </dd> <dt>error.description<span class="property-type">string</span></dt> <dd> Error description. </dd> <dt>error.tag<span class="property-type">string</span></dt> <dd> The name of the problematic variable on PLC. </dd> <dt>error.topic<span class="property-type">string</span></dt> <dd> The name of the problematic mapping (or tag) on PLC. </dd> <dt>object.timestamp<span class="property-type">timestamp</span></dt> <dd> Timestamp when error occurred. (Only when <b>Include timestamp</b> is checked). </dd> </dl> <h3>Details</h3> <p> All data is read cyclically from the PLC as configured in the <i>ethip endpoint</i>, but there are three modes of making it available in a flow:</p> <ul> <li> <b>Single tag:</b> A single tag can be selected from the configured tags, and a message is sent every time it changes. <code>msg.payload</code> contains the tag's value and <code>msg.topic</code> has the tag's name. See <a href="#output-desc">Outputs</a> section above for further details. </li> <li> <b>All tags, one per message:</b> Like the <i>Single tag</i> mode, but for all tags configured. </li> <li> <b>All tags:</b> In this mode, <code>msg.payload</code> contains an object with all configured tags and their values. A message is sent if at least one of the variables changes its value. </li> </ul> </script> <script type="text/html" data-help-name="eth-ip out"> <p>Writes <code>msg.payload</code> to a selected PLC tag</p> <p>This node was created as part of the <a href="https://st-one.io" target="_blank">ST-One</a> project</p> <p class="form-tips"> <b>Caution when writing data to production PLCs!</b><br/> Fully test everything you do. The authors cannot be liable for any damage or injury caused by the use of this node </p> <h3>Inputs</h3> <dl class="message-properties"> <dt>payload<span class="property-type">any</span></dt> <dd> the data to be written. It will be casted to the required data type whenever possible. </dd> <dt>variable<span class="property-type">string</span></dt> <dd> The variable to be written, if not defined in the configuration node. </dd> </dl> </script>