1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Some usage clarifications

This commit is contained in:
henols 2014-02-09 00:21:17 +01:00
parent 112a3abdc7
commit dc13290f97
2 changed files with 11 additions and 9 deletions

View File

@ -23,21 +23,22 @@
<label for="node-input-topic"><i class="icon-tasks"></i> Topic</label> <label for="node-input-topic"><i class="icon-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder=""> <input type="text" id="node-input-topic" placeholder="">
</div> </div>
<div class="form-row">
<label for="node-input-nodegroup"><i class="icon-tag"></i> Node Group</label>
<input type="text" id="node-input-nodegroup" placeholder="">
</div>
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label> <label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Emoncms"> <input type="text" id="node-input-name" placeholder="Emoncms">
</div> </div>
<div class="form-row"> <div class="form-tips">Topic is not mandatory, if Topic is left blank <b>msg.topic</b> will used. Topic overrides <b>msg.topic</b></br>
<label for="node-input-nodegroup"><i class="icon-tag"></i> Node</label> Node Group (numeric) is not mandatory, if Node Group is left blank <b>msg.nodegrpup</b> will used. Node Group overrides <b>msg.nodegroup</b></div>
<input type="text" id="node-input-nodegroup" placeholder="">
</div>
<div class="form-tips">If Topic is left blank the output Topic is the same as the input Topic.</div>
</script> </script>
<script type="text/x-red" data-help-name="emoncms"> <script type="text/x-red" data-help-name="emoncms">
<p>Performs post to Emoncms.</p> <p>Performs post to Emoncms.</p>
<p>The Topic is not mandatory, if Topic is left blank <b>msg.topic</b> will used.</p> <p>Topic is not mandatory, if Topic is left blank <b>msg.topic</b> will used. Topic overrides <b>msg.topic</b></p>
<p>The Node is not mandatory, (numberic)</p> <p>Node Group (numeric) is not mandatory, if Node Group is left blank <b>msg.nodegrpup</b> will used. Node overrides <b>msg.nodegrpup</b></p>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -40,9 +40,10 @@ function Emoncms(n) {
this.on("input", function(msg) { this.on("input", function(msg) {
var topic = this.topic || msg.topic; var topic = this.topic || msg.topic;
var nodegroup = this.nodegroup || msg.nodegroup;
this.url = this.baseurl + '/input/post.json?json={' + topic + ':' + msg.payload+'}&apikey='+this.apikey; this.url = this.baseurl + '/input/post.json?json={' + topic + ':' + msg.payload+'}&apikey='+this.apikey;
if(this.nodegroup != ""){ if(nodegroup != ""){
this.url += '&node='+this.nodegroup; this.url += '&node='+nodegroup;
} }
node.log("[emoncms] "+this.url); node.log("[emoncms] "+this.url);
http.get(this.url, function(res) { http.get(this.url, function(res) {