UNPKG

node-red-contrib-vscp-tcp

Version:
148 lines (130 loc) 6.32 kB
<!-- MIT License Copyright (c) 2020 Åke Hedman, Grodans Paradis AB This file is part of the VSCP (https://www.vscp.org) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> <script type="text/javascript"> RED.nodes.registerType('vscp-tcp-in',{ category: 'vscp', defaults: { name: {value:"", required:true}, host: {value:"", type:"vscp-tcp-config-host", required:true}, username: {value:"admin", required:true}, password: {value:"secret", required:true}, filter: {value:"", type:"vscp-tcp-config-filter", required:false}, keyctx: {value:"", required:false}, }, credentials: { username: {type:"text"}, password: {type:"password"} }, color:"#ffe033", inputs:0, outputs:1, icon: "font-awesome/fa-chevron-right", label: function() { return this.name||"VSCP"; }, labelStyle: function() { return this.name?"node_label_italic":""; } }); </script> <script type="text/x-red" data-template-name="vscp-tcp-in"> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <hr /> <div class="form-row"> <label for="node-input-host"><i class="fa fa-server"></i> Host</label> <input id="node-input-host" placeholder="---"> </div> <div class="form-row"> <label for="node-input-username"><i class="fa fa-user"></i> Username</label> <input type="text" id="node-input-username" placeholder="Username"> </div> <div class="form-row"> <label for="node-input-password"><i class="fa fa-key"></i> Password</label> <input type="password" id="node-input-password" placeholder="Password"> </div> <div class="form-row"> <label for="node-input-filter"><i class="fa fa-filter"></i> Filter</label> <input id="node-input-filter" placeholder=""> </div> <div class="form-row"> <label for="node-input-keyctx"><i class="fa fa-tag"></i> Context key</label> <input type="text" id="node-input-keyctx" placeholder="ctxkey"> </div> </script> <script type="text/x-red" data-help-name="vscp-tcp-in"> <p>VSCP tcp/ip input connection. Use to connect to a VSCP host that export the VSCP tcp/ip link protocol to get events from the host.</p> <h3>Inputs</h3> <ol class="node-ports"> This node has no input(s). </ol> <h3>Outputs</h3> <dl class="message-properties"> <dt>payload <span class="property-type">object</span> </dt> <dd> the payload is the JSON cfoded event received from the remote VSCP host. See details below for format.</dd> </dl> <h3>Details</h3> The VSCP tcp/ip link interface is an interface that allows a remote machine or user to control a VSCP hardware device or some software like the VSCP daemon. The interface allows for filtering and for sending AND receiving VSCP events among many other things. A VSCP JSON event object have thew following content <pre> { vscpHead: 3, vscpClass: 10, vscpType: 6, vscpObId: 0, vscpTimeStamp: 0, vscpDateTime: 2020-02-11T17:00:02.000Z, vscpGuid: 'FF:FF:FF:FF:FF:FF:FF:FE:B8:27:EB:40:59:96:00:01', vscpData: [ 1,2,3,4,5 ] } </pre> <p><b>vscpTimeStamp</b>, <b>vscpObId</b> and <b>vscpDateTime</b> can be omitted and will still automatically get meaningful defaults. <b>vscpHead</b> can also often be omitted and if so will be set to zero. <b>vscpGuid/b> can be set to '-' to be initialized to the GUID of <b>remote interface</b> which is enough to identify a common client. See <a href="https://docs.vscp.org/spec/latest">VSCP Specification</a> for VSCP class/type's and data content.</p> <p>Set a filter to just get the events you really is interested in from the remote host.</p> <p>Set a unique <b>context<(b>) if you want a sending and receiving VSCP node to work together. You set the same context in both the in and the out node. This will prevent the input node from receiving events sent through the output node. Context is defined on a flow level and therefore nodes relaying on this functionality must be placed the same flow/tab. </p> <p>If context is set to 'name' then <b>name.chid</b> will hold the channel id, <b>name.guid will hold the GUID</b> for the channel and <b>name.alive</b> will hold the time for the last event or sync message from the remote node. Data that can be reached from function nodes or the choice node.</p> <h3>References</h3> <ul> <li><a>https://docs.vscp.org/vscpd/latest/#/./tcp_ip_protocol_description</a> - full description of <code>VSCP tcp/ip link</code> protocol</li> <li><a>https://docs.vscp.org/</a> - documentation for VSCP</li> <li><a>https://github.com/grodansparadis/node-red-contrib-vscp-tcp</a> - the nodes github repository</li> <li><a>https://www.vscp.org/</a> - home of VSCP</li> </ul> </script>