node-red-contrib-modbus
Version:
The all in one Modbus TCP and Serial contribution long term supported package for Node-RED.
52 lines (51 loc) • 5.35 kB
HTML
<!--
Copyright (c) since the year 2016 Klaus Landsdorf (http://plus4nodered.com/)
All rights reserved.
node-red-contrib-modbus - The BSD 3-Clause License
@author <a href="mailto:klaus.landsdorf@bianco-royal.de">Klaus Landsdorf</a> (Bianco Royal)
--> <script type='text/javascript'>
RED.nodes.registerType("modbus-server",{category:"modbus",color:"#E9967A",defaults:{name:{value:""},logEnabled:{value:!1},hostname:{value:"0.0.0.0"},serverPort:{value:10502,required:!0,validate:RED.validators.number()},responseDelay:{value:100,required:!0,validate:RED.validators.number()},delayUnit:{value:"ms",required:!0,validate:function(e){return"ms"==e||"s"==e||"m"==e||"h"==e}},coilsBufferSize:{value:1e4,validate:RED.validators.number()},holdingBufferSize:{value:1e4,validate:RED.validators.number()},inputBufferSize:{value:1e4,validate:RED.validators.number()},discreteBufferSize:{value:1e4,validate:RED.validators.number()},showErrors:{value:!1},showStatusActivities:{value:!1}},inputs:1,outputs:5,align:"right",icon:"modbus.png",paletteLabel:"Modbus-Server",label:function(){return this.name||"Modbus Server"}})
</script> <script type='text/x-red' data-template-name='modbus-server'>
<div class='form-row'> <label for='node-input-name'><i class='icon-tag'></i> <span
data-i18n='node-red:common.label.name'></span></label> <input type='text' id='node-input-name' placeholder='Name'>
</div> <div class='form-row'> <label for='node-input-hostname'><i class='icon-tag'></i> <span
data-i18n='modbus-contrib.label.hostname'></span></label> <input type='text' id='node-input-hostname'
placeholder='0.0.0.0 (IPv4) or :: (IPv6)'> </div> <div class='form-row'> <label for='node-input-serverPort'><i
class='icon-tag'></i> <span data-i18n='modbus-contrib.label.port'></span></label> <input type='text'
id='node-input-serverPort' placeholder='2000 to 65536'> </div> <!-- <div class="form-row">
<label for="node-input-responseDelay"><i class="icon-tag"></i> <span data-i18n="modbus-contrib.label.responseDelay"></span></label>
<input type="text" id="node-input-responseDelay" placeholder="100" style="max-width:120px">
<select id="node-input-delayUnit" style="max-width:160px"> <option value="ms">millisecond(s)</option>
<option value="s">second(s)</option>
<option value="m">minute(s)</option>
<option value="h">hour(s)</option>
</select>
</div> --> <div class='form-row'> <label for='node-input-coilsBufferSize'><i class='icon-tag'></i> <span
data-i18n='modbus-contrib.label.coils'></span></label> <input type='text' id='node-input-coilsBufferSize'
placeholder='1024'> </div> <div class='form-row'> <label for='node-input-holdingBufferSize'><i class='icon-tag'></i>
<span data-i18n='modbus-contrib.label.holdings'></span></label> <input type='text' id='node-input-holdingBufferSize'
placeholder='1024'> </div> <div class='form-row'> <label for='node-input-inputBufferSize'><i class='icon-tag'></i> <span
data-i18n='modbus-contrib.label.inputs'></span></label> <input type='text' id='node-input-inputBufferSize'
placeholder='1024'> </div> <div class='form-row'> <label for='node-input-discreteBufferSize'><i class='icon-tag'></i>
<span data-i18n='modbus-contrib.label.discretes'></span></label> <input type='text' id='node-input-discreteBufferSize'
placeholder='1024'> </div> <hr> <div class='form-row'> <label style='min-width:190px'
for='node-input-showStatusActivities'><i class='fa fa-th'></i> <span data-i18n='modbus-contrib.label.showActivities'>
</span></label> <input type='checkbox' id='node-input-showStatusActivities' style='max-width:30px'> </div> <div
class='form-row'> <label style='min-width:190px' for='node-input-showErrors'><i class='fa fa-th'></i> <span
data-i18n='modbus-contrib.label.showErrors'></span></label> <input type='checkbox' id='node-input-showErrors'
style='max-width:30px'> </div> <div class='form-row'> <label style='min-width:190px' for='node-input-logEnabled'><i
class='fa fa-th'></i> <span data-i18n='modbus-contrib.label.logEnabled'></span></label> <input type='checkbox'
id='node-input-logEnabled' style='max-width:30px'> </div> </script> <script type='text/x-red'
data-help-name='modbus-server'>
<p>Node to provide a Modbus TCP server based on node-modbus (jsmodbus) for testing.</p> <p>
On injecting the server sends the Buffers to the separate outputs</p> <p>
You can use the Modbus write nodes (FC) to write data to the server buffers.</p> <p>
You can use the Modbus read nodes (FC) to read data from the server buffers.</p> <p>Output 1: holding Buffer, type, msg
</p> <p>Output 2: coils Buffer, type, msg</p> <p>Output 3: input Buffer, type, msg</p> <p>
Output 4: discrete Buffer, type, msg</p> <p>Output 5: request msg</p> <br> <p>
Input: On injecting a special payload, you can write directly to any register. This should only be used if you want to simulate a Modbus client.
<code>
msg.payload = { 'value': msg.payload, 'register': 'holding', 'address': 1 , 'disableMsgOutput' : 0 }; return msg;
</code> </p> <p>The value could also be a list of UInt8 numbers and they will be written to the buffer.</p> <p>
Valid registers are: </p><ul> <li>holding </li><li>coils </li><li>input </li><li>discrete </li></ul>
Set disableMsgOutput if you want to disable the Server outputs when injecting. <p></p> </script>