[{"data":1,"prerenderedAt":61},["ShallowReactive",2],{"integration-node-red-contrib-influxdb\u002F":3},{"_id":4,"categories":5,"author":9,"description":13,"npmOwners":14,"npmScope":17,"name":4,"ffCertified":18,"downloads":19,"version":21,"updatedAt":22,"maintainers":23,"homepage":28,"bugs":29,"repository":31,"time":34,"lastUpdated":22,"created":35,"license":58,"githubOwner":16,"githubRepo":4,"examples":59,"readme":60},"node-red-contrib-influxdb",[6,7,8],"catalogue_database","catalogue_storage","catalogue",{"name":10,"email":11,"url":12},"Mike Blackstock","mikeblackstock@gmail.com","http:\u002F\u002Fmblackstock.com","Node-RED nodes to save and query data from an influxdb time series database",[15,16],"sensetecnic","mblackstock",null,false,{"week":20},2264,"0.7.0","2023-12-30T22:43:01.742Z",[24,26],{"name":15,"email":25},"mblackstock@sensetecnic.com",{"name":16,"email":27},"mike@mblackstock.com","https:\u002F\u002Fgithub.com\u002Fmblackstock\u002Fnode-red-contrib-influxdb#readme",{"url":30},"https:\u002F\u002Fgithub.com\u002Fmblackstock\u002Fnode-red-contrib-influxdb\u002Fissues",{"type":32,"url":33},"git","git+https:\u002F\u002Fgithub.com\u002Fmblackstock\u002Fnode-red-contrib-influxdb.git",{"modified":22,"created":35,"0.0.1":35,"0.0.2":36,"0.0.3":37,"0.0.4":38,"0.0.5":39,"0.0.6":40,"0.1.0":41,"0.1.1":42,"0.2.0":43,"0.2.1":44,"0.2.2":45,"0.3.0":46,"0.3.1":47,"0.4.0":48,"0.4.1":49,"0.5.0":50,"0.5.1":51,"0.5.2":52,"0.5.3":53,"0.5.4":54,"0.6.0":55,"0.6.1":56,"0.7.0":57},"2015-10-12T22:36:03.676Z","2015-10-12T23:08:23.501Z","2015-10-22T21:29:57.025Z","2015-11-23T18:39:00.237Z","2015-12-28T22:41:45.559Z","2016-11-08T22:49:34.288Z","2017-03-09T01:18:10.695Z","2017-03-09T21:27:27.024Z","2017-06-12T03:33:54.765Z","2017-07-04T00:04:56.400Z","2018-09-30T02:31:58.603Z","2019-06-20T02:39:17.012Z","2019-09-04T18:17:27.776Z","2019-10-02T23:42:08.002Z","2020-06-21T21:59:23.415Z","2020-11-05T02:33:45.746Z","2020-11-20T04:03:38.052Z","2020-12-03T03:09:37.990Z","2020-12-19T03:48:15.590Z","2021-01-16T18:27:13.956Z","2021-04-05T22:57:08.008Z","2021-05-24T02:13:51.194Z","2023-12-30T22:43:01.544Z","Apache-2.0",[],"\u003Ch1 id=\"node-red-contrib-influxdb\">\u003Ca class=\"header-anchor\" href=\"#node-red-contrib-influxdb\">node-red-contrib-influxdb\u003C\u002Fa>\u003C\u002Fh1>\n\u003Cp>\u003Ca href=\"http:\u002F\u002Fnodered.org\" target=\"_new\">Node-RED\u003C\u002Fa> nodes to write and query data from an InfluxDB time series database.\u003C\u002Fp>\n\u003Cp>These nodes support both InfluxDB 1.x and InfluxDb 2.0 databases selected using the \u003Cstrong>Version\u003C\u002Fstrong> combo box in the configuration node.  See the documentation of the different nodes to understand the options provided by the different versions.  Currently the node uses two client libraries.\u003C\u002Fp>\n\u003Cp>When version \u003Cstrong>1.x\u003C\u002Fstrong> is selected these nodes use the \u003Ca href=\"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Finflux\" target=\"_new\">influxDB 1.x client\u003C\u002Fa> for node.js, specifically calling the \u003Cstrong>writePoints()\u003C\u002Fstrong>, and \u003Cstrong>query()\u003C\u002Fstrong> methods. Currently they can only communicate with one influxdb host. These nodes are used for writing and querying data in InfluxDB 1.x to 1.8+.\u003C\u002Fp>\n\u003Cp>When version \u003Cstrong>1.8-flux\u003C\u002Fstrong> is selected, the nodes use the \u003Ca href=\"https:\u002F\u002Fdocs.influxdata.com\u002Finfluxdb\u002Fv1.8\u002Ftools\u002Fapi\u002F#influxdb-2-0-api-compatibility-endpoints\" target=\"_new\"> influxDB 2.0 API compatibility endpoints\u003C\u002Fa> available in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Finfluxdata\u002Finfluxdb-client-js\" target=\"_new\">InfluxDB 2.0 client libraries\u003C\u002Fa> for node.js. These nodes are used for writing and querying data with Flux in InfluxDB 1.8+.\u003C\u002Fp>\n\u003Cp>When version \u003Cstrong>2.0\u003C\u002Fstrong> is selected, the nodes make use of the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Finfluxdata\u002Finfluxdb-client-js\" target=\"_new\">InfluxDB 2.0 client libraries\u003C\u002Fa> for writing and querying data with Flux in InfluxDB 2.0.\u003C\u002Fp>\n\u003Ch2 id=\"prerequisites\">\u003Ca class=\"header-anchor\" href=\"#prerequisites\">Prerequisites\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>To run this you'll need access to an InfluxDB database version 1.x, 1.8+ or 2.0. See the \u003Ca href=\"https:\u002F\u002Finfluxdb.com\u002F\" target=\"_new\">InfluxDB site\u003C\u002Fa> for more information. The latest release of this node has been tested with InfluxDB 1.8 and 2.0.  This node supports Node.js 10.x, 12.x and 14.x LTS releases.  It does \u003Cstrong>not\u003C\u002Fstrong> support Node.js 8.x.  This node does not support Node-RED before version 1.0.\u003C\u002Fp>\n\u003Ch2 id=\"install\">\u003Ca class=\"header-anchor\" href=\"#install\">Install\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>You can use the Node-RED \u003Cem>Manage Palette\u003C\u002Fem> feature, or run the following command in the root directory of your Node-RED install.  Usually this is \u003Ccode>~\u002F.node-red\u003C\u002Fcode> .\u003C\u002Fp>\n\u003Cpre>\u003Ccode>npm install node-red-contrib-influxdb\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2 id=\"usage\">\u003Ca class=\"header-anchor\" href=\"#usage\">Usage\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>Nodes to write and query data from an influxdb time series database. Supports InfluxDb versions 1.x to 2.0.\u003C\u002Fp>\n\u003Ch3 id=\"input-node\">\u003Ca class=\"header-anchor\" href=\"#input-node\">Input Node\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>Queries one or more measurements in an influxdb database.  The query is specified in the node configuration or in the \u003Cem>\u003Cstrong>msg.query\u003C\u002Fstrong>\u003C\u002Fem> property.  Setting it in the node will override the \u003Cem>\u003Cstrong>msg.query\u003C\u002Fstrong>\u003C\u002Fem>.  The result is returned in \u003Cem>\u003Cstrong>msg.payload\u003C\u002Fstrong>\u003C\u002Fem>.\u003C\u002Fp>\n\u003Cp>With a v1.x InfluxDb configuration, use the \u003Ca href=\"https:\u002F\u002Fdocs.influxdata.com\u002Finfluxdb\u002Fv1.8\u002Fquery_language\u002F\">InfluxQL query syntax\u003C\u002Fa>.  With a v1.8-Flux or 2.0 configuration, use the \u003Ca href=\"https:\u002F\u002Fdocs.influxdata.com\u002Finfluxdb\u002Fv2.0\u002Fquery-data\u002Fget-started\u002F\">Flux query syntax\u003C\u002Fa>.\u003C\u002Fp>\n\u003Cp>For example, here is a simple flow to query all of the points in the \u003Ccode>test\u003C\u002Fcode> measurement of the \u003Ccode>test\u003C\u002Fcode> database. The query is in the configuration of the influxdb input node (copy and paste to your Node-RED editor). We are using a v1.x InfluxDb here, so an InfluxQL query is used.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[{\"id\":\"39aa2ca9.804da4\",\"type\":\"debug\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":530,\"y\":100,\"wires\":[]},{\"id\":\"262a3923.e7b216\",\"type\":\"influxdb in\",\"z\":\"6256f76b.e596d8\",\"influxdb\":\"eeb221fb.ab27f\",\"name\":\"\",\"query\":\"SELECT * from test\",\"rawOutput\":false,\"precision\":\"\",\"retentionPolicy\":\"\",\"org\":\"my-org\",\"x\":310,\"y\":100,\"wires\":[[\"39aa2ca9.804da4\"]]},{\"id\":\"803d82f.ff80f8\",\"type\":\"inject\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":100,\"y\":100,\"wires\":[[\"262a3923.e7b216\"]]},{\"id\":\"eeb221fb.ab27f\",\"type\":\"influxdb\",\"hostname\":\"127.0.0.1\",\"port\":\"8086\",\"protocol\":\"http\",\"database\":\"test\",\"name\":\"test\",\"usetls\":true,\"tls\":\"d50d0c9f.31e858\",\"influxdbVersion\":\"1.x\",\"url\":\"http:\u002F\u002Flocalhost:8086\",\"rejectUnauthorized\":true},{\"id\":\"d50d0c9f.31e858\",\"type\":\"tls-config\",\"name\":\"\",\"cert\":\"\",\"key\":\"\",\"ca\":\"\",\"certname\":\"\",\"keyname\":\"\",\"caname\":\"\",\"servername\":\"\",\"verifyservercert\":false}]\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>In this example, we query the same database for all points from a day ago using a \u003Cstrong>1.8-flux\u003C\u002Fstrong> configuration using the Flux query language:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[{\"id\":\"dd32f825.863798\",\"type\":\"influxdb in\",\"z\":\"6256f76b.e596d8\",\"influxdb\":\"2ff2a476.a6d2ec\",\"name\":\"\",\"query\":\"from(bucket: \\\"test\u002Fautogen\\\") |&gt; range(start: -1d, stop: now())\",\"rawOutput\":false,\"precision\":\"\",\"retentionPolicy\":\"\",\"org\":\"my-org\",\"x\":410,\"y\":220,\"wires\":[[\"17314806.c732c8\"]]},{\"id\":\"17314806.c732c8\",\"type\":\"debug\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":670,\"y\":280,\"wires\":[]},{\"id\":\"eadef241.cf6fd\",\"type\":\"inject\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":100,\"y\":160,\"wires\":[[\"dd32f825.863798\"]]},{\"id\":\"2ff2a476.a6d2ec\",\"type\":\"influxdb\",\"hostname\":\"127.0.0.1\",\"port\":\"8086\",\"protocol\":\"http\",\"database\":\"database\",\"name\":\"test 1.8 flux\",\"usetls\":false,\"tls\":\"d50d0c9f.31e858\",\"influxdbVersion\":\"1.8-flux\",\"url\":\"https:\u002F\u002Flocalhost:8086\",\"rejectUnauthorized\":false},{\"id\":\"d50d0c9f.31e858\",\"type\":\"tls-config\",\"name\":\"\",\"cert\":\"\",\"key\":\"\",\"ca\":\"\",\"certname\":\"\",\"keyname\":\"\",\"caname\":\"\",\"servername\":\"\",\"verifyservercert\":false}]\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>This flow performs the same, but using the \u003Cem>\u003Cstrong>msg.query\u003C\u002Fstrong>\u003C\u002Fem> property:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[{\"id\":\"2d5d7690.e5e77a\",\"type\":\"influxdb in\",\"z\":\"6256f76b.e596d8\",\"influxdb\":\"2ff2a476.a6d2ec\",\"name\":\"\",\"query\":\"\",\"rawOutput\":false,\"precision\":\"\",\"retentionPolicy\":\"\",\"org\":\"my-org\",\"x\":300,\"y\":380,\"wires\":[[\"6ab91739.fa71b8\"]]},{\"id\":\"6ab91739.fa71b8\",\"type\":\"debug\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":490,\"y\":380,\"wires\":[]},{\"id\":\"daff744d.5538c8\",\"type\":\"function\",\"z\":\"6256f76b.e596d8\",\"name\":\"set query\",\"func\":\"msg.query = 'from(bucket: \\\"test\u002Fautogen\\\") |&gt; range(start: -1d, stop: now())'\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"initialize\":\"\",\"finalize\":\"\",\"x\":240,\"y\":300,\"wires\":[[\"2d5d7690.e5e77a\"]]},{\"id\":\"3e65472c.652658\",\"type\":\"inject\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"props\":[{\"p\":\"payload\"}],\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":100,\"y\":300,\"wires\":[[\"daff744d.5538c8\"]]},{\"id\":\"2ff2a476.a6d2ec\",\"type\":\"influxdb\",\"hostname\":\"127.0.0.1\",\"port\":\"8086\",\"protocol\":\"http\",\"database\":\"database\",\"name\":\"test 1.8 flux\",\"usetls\":false,\"tls\":\"d50d0c9f.31e858\",\"influxdbVersion\":\"1.8-flux\",\"url\":\"https:\u002F\u002Flocalhost:8086\",\"rejectUnauthorized\":false},{\"id\":\"d50d0c9f.31e858\",\"type\":\"tls-config\",\"name\":\"\",\"cert\":\"\",\"key\":\"\",\"ca\":\"\",\"certname\":\"\",\"keyname\":\"\",\"caname\":\"\",\"servername\":\"\",\"verifyservercert\":false}]\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The function node in this flow sets the \u003Ccode>msg.query\u003C\u002Fcode> property as follows:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>msg.query = 'from(bucket: \"test\u002Fautogen\") |&gt; range(start: -1d, stop: now())'\nreturn msg;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3 id=\"output-node\">\u003Ca class=\"header-anchor\" href=\"#output-node\">Output Node\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>Writes one or more points (fields and tags) to a measurement.\u003C\u002Fp>\n\u003Cp>The fields and tags to write are in \u003Cem>\u003Cstrong>msg.payload\u003C\u002Fstrong>\u003C\u002Fem>.  If the message is a string, number, or boolean, it will be written as a single field to the specified measurement called \u003Cem>value\u003C\u002Fem>.\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>Note: Javascript numbers are \u003Cem>always\u003C\u002Fem> written as a float.  When using the 1.8-flux or 2.0 configuration, you can explicitly write an integer using a number in a string with an 'i' suffix, for example, to write the integer \u003Ccode>1234\u003C\u002Fcode> use the string \u003Ccode>'1234i'\u003C\u002Fcode>.  This is \u003Cem>not\u003C\u002Fem> supported using 1.x configurations; all numbers are written as float values.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>For example, the following flow injects a single random field called \u003Ccode>value\u003C\u002Fcode> into the measurement \u003Ccode>test\u003C\u002Fcode> in the database \u003Ccode>test\u003C\u002Fcode> with the current timestamp.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[{\"id\":\"17bd4566.e842bb\",\"type\":\"influxdb out\",\"z\":\"6256f76b.e596d8\",\"influxdb\":\"eeb221fb.ab27f\",\"name\":\"\",\"measurement\":\"test\",\"precision\":\"\",\"retentionPolicy\":\"\",\"database\":\"\",\"retentionPolicyV18Flux\":\"\",\"org\":\"\",\"bucket\":\"\",\"x\":440,\"y\":460,\"wires\":[]},{\"id\":\"be93bfeb.416c4\",\"type\":\"function\",\"z\":\"6256f76b.e596d8\",\"name\":\"single value\",\"func\":\"msg.payload = Math.random()*10;\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"x\":270,\"y\":460,\"wires\":[[\"17bd4566.e842bb\"]]},{\"id\":\"31f9f174.ce060e\",\"type\":\"inject\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":120,\"y\":460,\"wires\":[[\"be93bfeb.416c4\"]]},{\"id\":\"eeb221fb.ab27f\",\"type\":\"influxdb\",\"hostname\":\"127.0.0.1\",\"port\":\"8086\",\"protocol\":\"http\",\"database\":\"test\",\"name\":\"test\",\"usetls\":true,\"tls\":\"d50d0c9f.31e858\",\"influxdbVersion\":\"1.x\",\"url\":\"http:\u002F\u002Flocalhost:8086\",\"rejectUnauthorized\":true},{\"id\":\"d50d0c9f.31e858\",\"type\":\"tls-config\",\"name\":\"\",\"cert\":\"\",\"key\":\"\",\"ca\":\"\",\"certname\":\"\",\"keyname\":\"\",\"caname\":\"\",\"servername\":\"\",\"verifyservercert\":false}]\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The function node consists of the following:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>msg.payload = Math.random()*10;\nreturn msg;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>If \u003Cem>\u003Cstrong>msg.payload\u003C\u002Fstrong>\u003C\u002Fem> is an object containing multiple properties, all of the the fields will be written to the measurement.\u003C\u002Fp>\n\u003Cp>For example, the following flow injects four fields, \u003Ccode>intValue\u003C\u002Fcode>, \u003Ccode>numValue\u003C\u002Fcode>, \u003Ccode>randomValue\u003C\u002Fcode> and \u003Ccode>strValue\u003C\u002Fcode> into the \u003Ccode>test2\u003C\u002Fcode> measurement with the current timestamp using a 1.8-Flux configuration.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[{\"id\":\"6849966e.e53528\",\"type\":\"inject\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":120,\"y\":520,\"wires\":[[\"c8865cec.261cd\"]]},{\"id\":\"c8865cec.261cd\",\"type\":\"function\",\"z\":\"6256f76b.e596d8\",\"name\":\"Fields\",\"func\":\"msg.payload = {\\n    intValue: '12i',\\n    numValue: 123.0,\\n    strValue: \\\"message\\\",\\n    randomValue: Math.random()*10\\n}\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"initialize\":\"\",\"finalize\":\"\",\"x\":268,\"y\":520,\"wires\":[[\"72bf0ba5.6e63d4\"]]},{\"id\":\"72bf0ba5.6e63d4\",\"type\":\"influxdb out\",\"z\":\"6256f76b.e596d8\",\"influxdb\":\"2ff2a476.a6d2ec\",\"name\":\"\",\"measurement\":\"test2\",\"precision\":\"\",\"retentionPolicy\":\"\",\"database\":\"test\",\"precisionV18FluxV20\":\"ms\",\"retentionPolicyV18Flux\":\"\",\"org\":\"\",\"bucket\":\"\",\"x\":458,\"y\":520,\"wires\":[]},{\"id\":\"2ff2a476.a6d2ec\",\"type\":\"influxdb\",\"hostname\":\"127.0.0.1\",\"port\":\"8086\",\"protocol\":\"http\",\"database\":\"database\",\"name\":\"test 1.8 flux\",\"usetls\":false,\"tls\":\"d50d0c9f.31e858\",\"influxdbVersion\":\"1.8-flux\",\"url\":\"https:\u002F\u002Flocalhost:8086\",\"rejectUnauthorized\":false},{\"id\":\"d50d0c9f.31e858\",\"type\":\"tls-config\",\"name\":\"\",\"cert\":\"\",\"key\":\"\",\"ca\":\"\",\"certname\":\"\",\"keyname\":\"\",\"caname\":\"\",\"servername\":\"\",\"verifyservercert\":false}]\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The function node in the flow above consists of the following:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>msg.payload = {\n    intValue: '10i',\n    numValue: 123.0,\n    strValue: \"message\",\n    randomValue: Math.random()*10\n}\nreturn msg;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>If \u003Cem>\u003Cstrong>msg.payload\u003C\u002Fstrong>\u003C\u002Fem> 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.\u003C\u002Fp>\n\u003Cp>For example, the following simple flow uses an InfluxDb 2.0 database and injects four fields as above, along with two tags, \u003Ccode>tag1\u003C\u002Fcode> and \u003Ccode>tag2\u003C\u002Fcode>:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[{\"id\":\"15c79e62.9294c2\",\"type\":\"inject\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":120,\"y\":560,\"wires\":[[\"a97b005f.7f22e\"]]},{\"id\":\"a97b005f.7f22e\",\"type\":\"function\",\"z\":\"6256f76b.e596d8\",\"name\":\"Fields and Tags\",\"func\":\"msg.payload = [{\\n    intValue: '10i',\\n    numValue: 12,\\n    randomValue: Math.random()*10,\\n    strValue: \\\"message2\\\"\\n},\\n{\\n    tag1:\\\"sensor1\\\",\\n    tag2:\\\"device2\\\"\\n}];\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"initialize\":\"\",\"finalize\":\"\",\"x\":280,\"y\":560,\"wires\":[[\"a91d522b.9a077\"]]},{\"id\":\"a91d522b.9a077\",\"type\":\"influxdb out\",\"z\":\"6256f76b.e596d8\",\"influxdb\":\"5d7e54ca.019d44\",\"name\":\"\",\"measurement\":\"test\",\"precision\":\"ms\",\"retentionPolicy\":\"\",\"database\":\"test\",\"precisionV18FluxV20\":\"ms\",\"retentionPolicyV18Flux\":\"\",\"org\":\"my-org\",\"bucket\":\"test\",\"x\":510,\"y\":560,\"wires\":[]},{\"id\":\"5d7e54ca.019d44\",\"type\":\"influxdb\",\"hostname\":\"127.0.0.1\",\"port\":\"8086\",\"protocol\":\"http\",\"database\":\"database\",\"name\":\"\",\"usetls\":false,\"tls\":\"d50d0c9f.31e858\",\"influxdbVersion\":\"2.0\",\"url\":\"https:\u002F\u002Flocalhost:9999\",\"rejectUnauthorized\":false},{\"id\":\"d50d0c9f.31e858\",\"type\":\"tls-config\",\"name\":\"\",\"cert\":\"\",\"key\":\"\",\"ca\":\"\",\"certname\":\"\",\"keyname\":\"\",\"caname\":\"\",\"servername\":\"\",\"verifyservercert\":false}]\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The function node consists of the following code:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>msg.payload = [{\n    intValue: '10i',\n    numValue: 12,\n    randomValue: Math.random()*10,\n    strValue: \"message2\"\n},\n{\n    tag1:\"sensor1\",\n    tag2:\"device2\"\n}];\nreturn msg;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Finally, if \u003Cem>\u003Cstrong>msg.payload\u003C\u002Fstrong>\u003C\u002Fem> is an array of arrays, it will be written as a series of points containing fields and tags.\u003C\u002Fp>\n\u003Cp>For example, the following flow injects two points into an InfluxDb 2.0 database with timestamps specified.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[{\"id\":\"a67139c7.15ec68\",\"type\":\"inject\",\"z\":\"6256f76b.e596d8\",\"name\":\"\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":120,\"y\":620,\"wires\":[[\"15047e0e.e613f2\"]]},{\"id\":\"15047e0e.e613f2\",\"type\":\"function\",\"z\":\"6256f76b.e596d8\",\"name\":\"multiple readings\",\"func\":\"msg.payload = [\\n    [{\\n        numValue: 10,\\n        randomValue: Math.random()*10,\\n        strValue: \\\"message1\\\",\\n        time: new Date().getTime()-1\\n    },\\n    {\\n        tag1:\\\"sensor1\\\",\\n        tag2:\\\"device2\\\"\\n    }],\\n    [{\\n        numValue: 20,\\n        randomValue: Math.random()*10,\\n        strValue: \\\"message2\\\",\\n        time: new Date().getTime()\\n    },\\n    {\\n        tag1:\\\"sensor1\\\",\\n        tag2:\\\"device2\\\"\\n    }]\\n];\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"initialize\":\"\",\"finalize\":\"\",\"x\":320,\"y\":620,\"wires\":[[\"8caaee80.33352\"]]},{\"id\":\"8caaee80.33352\",\"type\":\"influxdb out\",\"z\":\"6256f76b.e596d8\",\"influxdb\":\"5d7e54ca.019d44\",\"name\":\"\",\"measurement\":\"test\",\"precision\":\"ms\",\"retentionPolicy\":\"\",\"database\":\"test\",\"precisionV18FluxV20\":\"ms\",\"retentionPolicyV18Flux\":\"\",\"org\":\"my-org\",\"bucket\":\"test\",\"x\":590,\"y\":620,\"wires\":[]},{\"id\":\"5d7e54ca.019d44\",\"type\":\"influxdb\",\"hostname\":\"127.0.0.1\",\"port\":\"8086\",\"protocol\":\"http\",\"database\":\"database\",\"name\":\"\",\"usetls\":false,\"tls\":\"d50d0c9f.31e858\",\"influxdbVersion\":\"2.0\",\"url\":\"https:\u002F\u002Flocalhost:9999\",\"rejectUnauthorized\":false},{\"id\":\"d50d0c9f.31e858\",\"type\":\"tls-config\",\"name\":\"\",\"cert\":\"\",\"key\":\"\",\"ca\":\"\",\"certname\":\"\",\"keyname\":\"\",\"caname\":\"\",\"servername\":\"\",\"verifyservercert\":false}]\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The function node in the above flow looks as follows:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>msg.payload = [\n    [{\n        intValue: '9i',\n        numValue: 10,\n        randomValue: Math.random()*10,\n        strValue: \"message1\",\n        time: new Date().getTime()-1\n    },\n    {\n        tag1:\"sensor1\",\n        tag2:\"device2\"\n    }],\n    [{\n        intValue: '11i',\n        numValue: 20,\n        randomValue: Math.random()*10,\n        strValue: \"message2\",\n        time: new Date().getTime()\n    },\n    {\n        tag1:\"sensor1\",\n        tag2:\"device2\"\n    }]\n];\nreturn msg;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Note how timestamps are specified here - the number of milliseconds since 1 January 1970 00:00:00 UTC. In this case do not forget to set the precision to \"ms\" in \"Time Precision\" of the \"Influx Out Node\".  We make sure the timestamps are a different so the first element doesn't get overwritten by the second.\u003C\u002Fp>\n\u003Ch3 id=\"the-batch-output-node\">\u003Ca class=\"header-anchor\" href=\"#the-batch-output-node\">The Batch Output Node\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>The batch output node (influx batch) sends a list of \u003Cem>points\u003C\u002Fem> together in a batch to InfluxDB in a slightly different format from the output node. Using the batch node you must specify the measurement name to write into as well as a list of tag and field values. Optionally, you can specify the timestamp for the point, defaulting to the current time.\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>Note: Javascript numbers are \u003Cem>always\u003C\u002Fem> written as a float.  As in the output node, when using the 1.8-flux or 2.0 configuration, you can explicitly write an integer using a number in a string with an 'i' suffix, for example, to write the integer \u003Ccode>1234\u003C\u002Fcode> use the string \u003Ccode>'1234i'\u003C\u002Fcode>.  This is \u003Cem>not\u003C\u002Fem> supported using 1.x configurations; all numbers are written as float values.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>By default the node will write timestamps using ms precision since that's what JavaScript gives us. if you specify the timestamp as a Date object, we'll convert it to milliseconds.\u003C\u002Fp>\n\u003Cp>If you provide a string or number as the timestamp, we'll pass it straight into Influx to parse using the specified precision, or the default precision in nanoseconds if it is left unspecified.\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>\u003Cstrong>Note\u003C\u002Fstrong> that the default precision is \u003Cem>nanoseconds\u003C\u002Fem>, so if you pass in a number such as date.getTime(), and do not specify millisecond precision, your timestamp will be orders of magnitude incorrect.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>The following example flow writes two points to two measurements, setting the timestamp to the current date.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[{\"id\":\"4a271a88.499184\",\"type\":\"function\",\"z\":\"87205ed6.329bc\",\"name\":\"multiple measurement points\",\"func\":\"msg.payload = [\\n    {\\n        measurement: \\\"weather_sensor\\\",\\n        fields: {\\n            temp: 5.5,\\n            light: 678,\\n            humidity: 51\\n        },\\n        tags:{\\n            location:\\\"garden\\\"\\n        },\\n        timestamp: new Date()\\n    },\\n    {\\n        measurement: \\\"alarm_sensor\\\",\\n        fields: {\\n            proximity: 999,\\n            temp: 19.5\\n        },\\n        tags:{\\n            location:\\\"home\\\"\\n        },\\n        timestamp: new Date()\\n    }\\n];\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"x\":400,\"y\":280,\"wires\":[[\"748a06bd.675ed8\"]]},{\"id\":\"6493a442.1cdcbc\",\"type\":\"inject\",\"z\":\"87205ed6.329bc\",\"name\":\"\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":140,\"y\":220,\"wires\":[[\"4a271a88.499184\"]]},{\"id\":\"748a06bd.675ed8\",\"type\":\"influxdb batch\",\"z\":\"87205ed6.329bc\",\"influxdb\":\"6ca8bde.9eb2f44\",\"name\":\"\",\"x\":670,\"y\":220,\"wires\":[]},{\"id\":\"6ca8bde.9eb2f44\",\"type\":\"influxdb\",\"z\":\"\",\"hostname\":\"localhost\",\"port\":\"8086\",\"protocol\":\"https\",\"database\":\"new_db\",\"name\":\"\",\"usetls\":true,\"tls\":\"f7f39f4e.896ae\"},{\"id\":\"f7f39f4e.896ae\",\"type\":\"tls-config\",\"z\":\"\",\"name\":\"local-tls\",\"cert\":\"\",\"key\":\"\",\"ca\":\"\",\"certname\":\"\",\"keyname\":\"\",\"caname\":\"\",\"verifyservercert\":false}]\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The function node generates sample points as follows:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>msg.payload = [\n    {\n        measurement: \"weather_sensor\",\n        fields: {\n            temp: 5.5,\n            light: 678,\n            humidity: 51\n        },\n        tags:{\n            location:\"garden\"\n        },\n        timestamp: new Date()\n    },\n    {\n        measurement: \"alarm_sensor\",\n        fields: {\n            proximity: 999,\n            temp: 19.5\n        },\n        tags:{\n            location:\"home\"\n        },\n        timestamp: new Date()\n    }\n];\nreturn msg;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3 id=\"catching-failed-reads-and-writes\">\u003Ca class=\"header-anchor\" href=\"#catching-failed-reads-and-writes\">Catching Failed Reads and Writes\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>Errors in reads and writes can be caught using the node-red \u003Ccode>catch\u003C\u002Fcode> node as usual.\nStandard error information is availlable in the default \u003Ccode>msg.error\u003C\u002Fcode> field; additional\ninformation about the underlying error is in the \u003Ccode>msg.influx_error\u003C\u002Fcode> field. Currently,\nthis includes the HTTP status code returned from the influxdb server. The \u003Ccode>influx-read\u003C\u002Fcode>\nnode will always throw a \u003Ccode>503\u003C\u002Fcode>, whereas the write nodes will include other status codes\nas detailed in the\n\u003Ca href=\"https:\u002F\u002Fdocs.influxdata.com\u002Finfluxdb\u002Fv1.8\u002Ftools\u002Fapi\u002F#status-codes-and-responses-2\">Influx API documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003Ch3 id=\"support-for-complete-node\">\u003Ca class=\"header-anchor\" href=\"#support-for-complete-node\">Support for Complete Node\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>All of the nodes make the required \u003Ccode>done()\u003C\u002Fcode> call to support the \u003Ccode>complete\u003C\u002Fcode> node as described in the \u003Ca href=\"https:\u002F\u002Fnodered.org\u002Fblog\u002F2019\u002F09\u002F20\u002Fnode-done\">related blog post\u003C\u002Fa>. When an error is logged, \u003Ccode>catch\u003C\u002Fcode> nodes will receive a message, but an associated \u003Ccode>complete\u003C\u002Fcode> node will not.\u003C\u002Fp>\n",1781547797395]