mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
2fe859b111
NLS exec node NLS function/temple/delay nodes NLS function/template/delay/trigger/comment nodes NLS io nodes (mqtt/httpin/websocket/watch/serial) NLS messages.json for tcpin NLS io nodes (tcpin & udp half) NLS io nodes (udp) NLS logic nodes (switch/change) NLS logic (range) and parsers (csv&html) nodes NLS parser nodes (json/xml) NLS test case update for logic/parsers NLS analysis and hardware nodes NLS storage nodes (file/redisout/mongodb) and test NLS storage node (tail) NLS social nodes (feedparse/email/irc) NLS socal node (twitter half change) NLS social node (twitter) and core node (unknown)
158 lines
6.9 KiB
HTML
158 lines
6.9 KiB
HTML
<!--
|
|
Copyright 2013,2014 IBM Corp.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<script type="text/x-red" data-template-name="mqtt in">
|
|
<div class="form-row">
|
|
<label for="node-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt.label.broker"></span></label>
|
|
<input type="text" id="node-input-broker">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-topic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
|
<input type="text" id="node-input-topic" data-i18n="[placeholder]common.label.topicph">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
|
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.nameph">
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/x-red" data-help-name="mqtt in">
|
|
<p>MQTT input node. Connects to a broker and subscribes to the specified topic. The topic may contain MQTT wildcards.</p>
|
|
<p>Outputs an object called <b>msg</b> containing <b>msg.topic, msg.payload, msg.qos</b> and <b>msg.retain</b>.</p>
|
|
<p><b>msg.payload</b> is usually a string, but can also be a binary buffer.</p>
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
RED.nodes.registerType('mqtt in',{
|
|
category: 'input',
|
|
defaults: {
|
|
name: {value:""},
|
|
topic: {value:"",required:true},
|
|
broker: {type:"mqtt-broker", required:true}
|
|
},
|
|
color:"#d8bfd8",
|
|
inputs:0,
|
|
outputs:1,
|
|
icon: "bridge.png",
|
|
label: function() {
|
|
return this.name||this.topic||"mqtt";
|
|
},
|
|
labelStyle: function() {
|
|
return this.name?"node_label_italic":"";
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script type="text/x-red" data-template-name="mqtt out">
|
|
<div class="form-row">
|
|
<label for="node-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt.label.broker"></span></label>
|
|
<input type="text" id="node-input-broker">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-topic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
|
<input type="text" id="node-input-topic" data-i18n="[placeholder]common.label.topicph">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-qos"><i class="fa fa-empire"></i> <span data-i18n="mqtt.label.qos"></span></label>
|
|
<select id="node-input-qos" style="width:125px !important">
|
|
<option value=""></option>
|
|
<option value="0">0</option>
|
|
<option value="1">1</option>
|
|
<option value="2">2</option>
|
|
</select>
|
|
<i class="fa fa-history"></i> <span data-i18n="mqtt.retain"></span> <select id="node-input-retain" style="width:125px !important">
|
|
<option value=""></option>
|
|
<option value="false" data-i18n="mqtt.false"></option>
|
|
<option value="true" data-i18n="mqtt.true"></option>
|
|
</select>
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
|
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.nameph">
|
|
</div>
|
|
<div class="form-tips"><span data-i18n="mqtt.tip"></span></div>
|
|
</script>
|
|
|
|
<script type="text/x-red" data-help-name="mqtt out">
|
|
<p>Connects to a MQTT broker and publishes <b>msg.payload</b> either to the <b>msg.topic</b> or to the topic specified in the edit window. The value in the edit window has precedence.</p>
|
|
<p>Likewise QoS and/or retain values in the edit panel will overwrite any <b>msg.qos</b> and <b>msg.retain</b> properties. If nothing is set they default to <i>0</i> and <i>false</i> respectively.</p>
|
|
<p>If <b>msg.payload</b> contains an object it will be stringified before being sent.</p>
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
RED.nodes.registerType('mqtt out',{
|
|
category: 'output',
|
|
defaults: {
|
|
name: {value:""},
|
|
topic: {value:""},
|
|
qos: {value:""},
|
|
retain: {value:""},
|
|
broker: {type:"mqtt-broker", required:true}
|
|
},
|
|
color:"#d8bfd8",
|
|
inputs:1,
|
|
outputs:0,
|
|
icon: "bridge.png",
|
|
align: "right",
|
|
label: function() {
|
|
return this.name||this.topic||"mqtt";
|
|
},
|
|
labelStyle: function() {
|
|
return this.name?"node_label_italic":"";
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script type="text/x-red" data-template-name="mqtt-broker">
|
|
<div class="form-row node-input-broker">
|
|
<label for="node-config-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt.label.broker"></span></label>
|
|
<input class="input-append-left" type="text" id="node-config-input-broker" placeholder="localhost" style="width: 40%;" >
|
|
<label for="node-config-input-port" style="margin-left: 10px; width: 35px; "> <span data-i18n="mqtt.port"></span></label>
|
|
<input type="text" id="node-config-input-port" data-i18n="[placeholder]mqtt.portph" style="width:45px">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-config-input-clientid"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.clientid"></span></label>
|
|
<input type="text" id="node-config-input-clientid" data-i18n="[placeholder]mqtt.label.clientidph">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-config-input-user"><i class="fa fa-user"></i> <span data-i18n="common.label.username"></span></label>
|
|
<input type="text" id="node-config-input-user">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-config-input-password"><i class="fa fa-lock"></i> <span data-i18n="common.label.password"></span></label>
|
|
<input type="password" id="node-config-input-password">
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
RED.nodes.registerType('mqtt-broker',{
|
|
category: 'config',
|
|
defaults: {
|
|
broker: {value:"",required:true},
|
|
port: {value:1883,required:true,validate:RED.validators.number()},
|
|
clientid: { value:"" }
|
|
},
|
|
credentials: {
|
|
user: {type:"text"},
|
|
password: {type: "password"}
|
|
},
|
|
label: function() {
|
|
if (this.broker == "") { this.broker = "localhost"; }
|
|
return (this.clientid?this.clientid+"@":"")+this.broker+":"+this.port;
|
|
}
|
|
});
|
|
</script>
|