node-red-contrib-influxdb
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -7,2 +7,5 @@ var _ = require('lodash'); | ||
/** | ||
* Config node. Currently we only connect to one host. | ||
*/ | ||
function InfluxConfigNode(n) { | ||
@@ -23,3 +26,5 @@ RED.nodes.createNode(this,n); | ||
/** | ||
* Output node to write to an influxdb measurement | ||
*/ | ||
function InfluxOutNode(n) { | ||
@@ -40,3 +45,3 @@ RED.nodes.createNode(this,n); | ||
}); | ||
// when we get a message, write it to influxdb | ||
node.on("input",function(msg) { | ||
@@ -85,6 +90,2 @@ var measurement; | ||
} | ||
this.on("close", function() { | ||
// not sure we need to do anything here | ||
}); | ||
} | ||
@@ -94,2 +95,5 @@ | ||
/** | ||
* Input node to make queries to influxdb | ||
*/ | ||
function InfluxInNode(n) { | ||
@@ -123,3 +127,2 @@ RED.nodes.createNode(this,n); | ||
} | ||
console.log("query:"+query); | ||
client.query(query, function(err, results) { | ||
@@ -137,10 +140,4 @@ if (err) { | ||
} | ||
this.on("close", function() { | ||
// if (this.clientDb) { | ||
// this.clientDb.close(); | ||
// } | ||
}); | ||
} | ||
RED.nodes.registerType("influxdb in",InfluxInNode); | ||
} |
{ | ||
"name": "node-red-contrib-influxdb", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Node-RED nodes to save and query data from an influxdb time series database", | ||
@@ -5,0 +5,0 @@ "main": "influxdb.js", |
node-red-contrib-influxdb | ||
========================= | ||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to save and query data from an influxdb time series database. | ||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to write and query data from an influxdb time series database. These nodes use the <a href="https://www.npmjs.com/package/influx" target="_new">influxDB client</a> for node.js, specifically calling the **writePoint()**, **writePoints()**, and **query()** methods. Currently it can only communicate with one influxdb host. | ||
@@ -9,3 +9,3 @@ Pre-requesites | ||
To run this you'll need access to an influxdb database version 0.9.x, possibly later. | ||
To run this you'll need access to an influxdb database version 0.9.x, possibly later. See the <a href="https://influxdb.com/" target="_new">influxdb site</a> for more information. | ||
@@ -15,2 +15,5 @@ Install | ||
Run the following command in the root directory of your Node-RED install. | ||
Usually this is `~/.node-red` . | ||
npm install node-red-node-influxdb | ||
@@ -20,1 +23,19 @@ | ||
----- | ||
Nodes to write and query data from an influxdb time series database. | ||
### Input Node | ||
Queries one or more measurements in an influxdb database. The query is specified in the node configuration or in the ***msg.query*** property. Setting it in the node will override the ***msg.query***. The result is returned in ***msg.payload***. | ||
### Output Node | ||
Writes one or more points (fields and tags) to a measurement. | ||
The fields and tags to write are in ***msg.payload***. If the message is a string, number, or boolean, it will be written as a single value to the specified measurement (called *value*). | ||
If ***msg.payload*** is an object containing multiple properties, the fields will be written to the measurement. | ||
If ***msg.payload*** is an array containing two objects, the first object will be written as the set of named fields, the second is the set of named tags. | ||
Finally, if ***msg.payload*** is an array of arrays, it will be written as a series of points containing fields and tags. |
15149
39
143