From 29b2ee9362d31c9f29602e17dcabb4cecf8e3b91 Mon Sep 17 00:00:00 2001 From: Paul Reed Date: Sun, 16 Mar 2014 20:05:28 +0000 Subject: [PATCH] Payload format change for emoncms v8.0 A payload format change is necessary for the node to function with emoncms v8.0 (current version). The latest version of emoncms introduces a 'key' to identify inputs within each emoncms node group, and is automatically assigned by emoncms, but for this to occur, it is necessary to change the format of the payload. The changes have also been tested with multiple inputs in the same node, ie inject a comma-separated payload such as 100,98,365 and emoncms will automatically parse the values, and result in 3 inputs within the same emoncms node. These changes are also backwards-compatible with previous emoncms versions. --- io/emoncms/88-emoncms.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/io/emoncms/88-emoncms.js b/io/emoncms/88-emoncms.js index 4138b0bc..75381aec 100644 --- a/io/emoncms/88-emoncms.js +++ b/io/emoncms/88-emoncms.js @@ -80,10 +80,9 @@ function Emoncms(n) { 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; if(nodegroup != ""){ - this.url += '&node='+nodegroup; - } + this.url = this.baseurl + '/input/post.json?node=' + nodegroup + '&csv=' + msg.payload+'&apikey='+this.apikey; + } node.log("[emoncms] "+this.url); http.get(this.url, function(res) { node.log("Http response: " + res.statusCode);