[{"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\" tabindex=\"-1\">\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\" tabindex=\"-1\">\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\" tabindex=\"-1\">\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\" tabindex=\"-1\">\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\" tabindex=\"-1\">\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>[{&quot;id&quot;:&quot;39aa2ca9.804da4&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;false&quot;,&quot;x&quot;:530,&quot;y&quot;:100,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;262a3923.e7b216&quot;,&quot;type&quot;:&quot;influxdb in&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;influxdb&quot;:&quot;eeb221fb.ab27f&quot;,&quot;name&quot;:&quot;&quot;,&quot;query&quot;:&quot;SELECT * from test&quot;,&quot;rawOutput&quot;:false,&quot;precision&quot;:&quot;&quot;,&quot;retentionPolicy&quot;:&quot;&quot;,&quot;org&quot;:&quot;my-org&quot;,&quot;x&quot;:310,&quot;y&quot;:100,&quot;wires&quot;:[[&quot;39aa2ca9.804da4&quot;]]},{&quot;id&quot;:&quot;803d82f.ff80f8&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;onceDelay&quot;:0.1,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;&quot;,&quot;payloadType&quot;:&quot;date&quot;,&quot;x&quot;:100,&quot;y&quot;:100,&quot;wires&quot;:[[&quot;262a3923.e7b216&quot;]]},{&quot;id&quot;:&quot;eeb221fb.ab27f&quot;,&quot;type&quot;:&quot;influxdb&quot;,&quot;hostname&quot;:&quot;127.0.0.1&quot;,&quot;port&quot;:&quot;8086&quot;,&quot;protocol&quot;:&quot;http&quot;,&quot;database&quot;:&quot;test&quot;,&quot;name&quot;:&quot;test&quot;,&quot;usetls&quot;:true,&quot;tls&quot;:&quot;d50d0c9f.31e858&quot;,&quot;influxdbVersion&quot;:&quot;1.x&quot;,&quot;url&quot;:&quot;http:\u002F\u002Flocalhost:8086&quot;,&quot;rejectUnauthorized&quot;:true},{&quot;id&quot;:&quot;d50d0c9f.31e858&quot;,&quot;type&quot;:&quot;tls-config&quot;,&quot;name&quot;:&quot;&quot;,&quot;cert&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;ca&quot;:&quot;&quot;,&quot;certname&quot;:&quot;&quot;,&quot;keyname&quot;:&quot;&quot;,&quot;caname&quot;:&quot;&quot;,&quot;servername&quot;:&quot;&quot;,&quot;verifyservercert&quot;: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>[{&quot;id&quot;:&quot;dd32f825.863798&quot;,&quot;type&quot;:&quot;influxdb in&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;influxdb&quot;:&quot;2ff2a476.a6d2ec&quot;,&quot;name&quot;:&quot;&quot;,&quot;query&quot;:&quot;from(bucket: \\&quot;test\u002Fautogen\\&quot;) |&gt; range(start: -1d, stop: now())&quot;,&quot;rawOutput&quot;:false,&quot;precision&quot;:&quot;&quot;,&quot;retentionPolicy&quot;:&quot;&quot;,&quot;org&quot;:&quot;my-org&quot;,&quot;x&quot;:410,&quot;y&quot;:220,&quot;wires&quot;:[[&quot;17314806.c732c8&quot;]]},{&quot;id&quot;:&quot;17314806.c732c8&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;false&quot;,&quot;x&quot;:670,&quot;y&quot;:280,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;eadef241.cf6fd&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;onceDelay&quot;:0.1,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;&quot;,&quot;payloadType&quot;:&quot;date&quot;,&quot;x&quot;:100,&quot;y&quot;:160,&quot;wires&quot;:[[&quot;dd32f825.863798&quot;]]},{&quot;id&quot;:&quot;2ff2a476.a6d2ec&quot;,&quot;type&quot;:&quot;influxdb&quot;,&quot;hostname&quot;:&quot;127.0.0.1&quot;,&quot;port&quot;:&quot;8086&quot;,&quot;protocol&quot;:&quot;http&quot;,&quot;database&quot;:&quot;database&quot;,&quot;name&quot;:&quot;test 1.8 flux&quot;,&quot;usetls&quot;:false,&quot;tls&quot;:&quot;d50d0c9f.31e858&quot;,&quot;influxdbVersion&quot;:&quot;1.8-flux&quot;,&quot;url&quot;:&quot;https:\u002F\u002Flocalhost:8086&quot;,&quot;rejectUnauthorized&quot;:false},{&quot;id&quot;:&quot;d50d0c9f.31e858&quot;,&quot;type&quot;:&quot;tls-config&quot;,&quot;name&quot;:&quot;&quot;,&quot;cert&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;ca&quot;:&quot;&quot;,&quot;certname&quot;:&quot;&quot;,&quot;keyname&quot;:&quot;&quot;,&quot;caname&quot;:&quot;&quot;,&quot;servername&quot;:&quot;&quot;,&quot;verifyservercert&quot;: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>[{&quot;id&quot;:&quot;2d5d7690.e5e77a&quot;,&quot;type&quot;:&quot;influxdb in&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;influxdb&quot;:&quot;2ff2a476.a6d2ec&quot;,&quot;name&quot;:&quot;&quot;,&quot;query&quot;:&quot;&quot;,&quot;rawOutput&quot;:false,&quot;precision&quot;:&quot;&quot;,&quot;retentionPolicy&quot;:&quot;&quot;,&quot;org&quot;:&quot;my-org&quot;,&quot;x&quot;:300,&quot;y&quot;:380,&quot;wires&quot;:[[&quot;6ab91739.fa71b8&quot;]]},{&quot;id&quot;:&quot;6ab91739.fa71b8&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;false&quot;,&quot;x&quot;:490,&quot;y&quot;:380,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;daff744d.5538c8&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;set query&quot;,&quot;func&quot;:&quot;msg.query = 'from(bucket: \\&quot;test\u002Fautogen\\&quot;) |&gt; range(start: -1d, stop: now())'\\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;initialize&quot;:&quot;&quot;,&quot;finalize&quot;:&quot;&quot;,&quot;x&quot;:240,&quot;y&quot;:300,&quot;wires&quot;:[[&quot;2d5d7690.e5e77a&quot;]]},{&quot;id&quot;:&quot;3e65472c.652658&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;props&quot;:[{&quot;p&quot;:&quot;payload&quot;}],&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;onceDelay&quot;:0.1,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;&quot;,&quot;payloadType&quot;:&quot;date&quot;,&quot;x&quot;:100,&quot;y&quot;:300,&quot;wires&quot;:[[&quot;daff744d.5538c8&quot;]]},{&quot;id&quot;:&quot;2ff2a476.a6d2ec&quot;,&quot;type&quot;:&quot;influxdb&quot;,&quot;hostname&quot;:&quot;127.0.0.1&quot;,&quot;port&quot;:&quot;8086&quot;,&quot;protocol&quot;:&quot;http&quot;,&quot;database&quot;:&quot;database&quot;,&quot;name&quot;:&quot;test 1.8 flux&quot;,&quot;usetls&quot;:false,&quot;tls&quot;:&quot;d50d0c9f.31e858&quot;,&quot;influxdbVersion&quot;:&quot;1.8-flux&quot;,&quot;url&quot;:&quot;https:\u002F\u002Flocalhost:8086&quot;,&quot;rejectUnauthorized&quot;:false},{&quot;id&quot;:&quot;d50d0c9f.31e858&quot;,&quot;type&quot;:&quot;tls-config&quot;,&quot;name&quot;:&quot;&quot;,&quot;cert&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;ca&quot;:&quot;&quot;,&quot;certname&quot;:&quot;&quot;,&quot;keyname&quot;:&quot;&quot;,&quot;caname&quot;:&quot;&quot;,&quot;servername&quot;:&quot;&quot;,&quot;verifyservercert&quot;: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: &quot;test\u002Fautogen&quot;) |&gt; range(start: -1d, stop: now())'\nreturn msg;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3 id=\"output-node\" tabindex=\"-1\">\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>[{&quot;id&quot;:&quot;17bd4566.e842bb&quot;,&quot;type&quot;:&quot;influxdb out&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;influxdb&quot;:&quot;eeb221fb.ab27f&quot;,&quot;name&quot;:&quot;&quot;,&quot;measurement&quot;:&quot;test&quot;,&quot;precision&quot;:&quot;&quot;,&quot;retentionPolicy&quot;:&quot;&quot;,&quot;database&quot;:&quot;&quot;,&quot;retentionPolicyV18Flux&quot;:&quot;&quot;,&quot;org&quot;:&quot;&quot;,&quot;bucket&quot;:&quot;&quot;,&quot;x&quot;:440,&quot;y&quot;:460,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;be93bfeb.416c4&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;single value&quot;,&quot;func&quot;:&quot;msg.payload = Math.random()*10;\\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;x&quot;:270,&quot;y&quot;:460,&quot;wires&quot;:[[&quot;17bd4566.e842bb&quot;]]},{&quot;id&quot;:&quot;31f9f174.ce060e&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;&quot;,&quot;payloadType&quot;:&quot;date&quot;,&quot;x&quot;:120,&quot;y&quot;:460,&quot;wires&quot;:[[&quot;be93bfeb.416c4&quot;]]},{&quot;id&quot;:&quot;eeb221fb.ab27f&quot;,&quot;type&quot;:&quot;influxdb&quot;,&quot;hostname&quot;:&quot;127.0.0.1&quot;,&quot;port&quot;:&quot;8086&quot;,&quot;protocol&quot;:&quot;http&quot;,&quot;database&quot;:&quot;test&quot;,&quot;name&quot;:&quot;test&quot;,&quot;usetls&quot;:true,&quot;tls&quot;:&quot;d50d0c9f.31e858&quot;,&quot;influxdbVersion&quot;:&quot;1.x&quot;,&quot;url&quot;:&quot;http:\u002F\u002Flocalhost:8086&quot;,&quot;rejectUnauthorized&quot;:true},{&quot;id&quot;:&quot;d50d0c9f.31e858&quot;,&quot;type&quot;:&quot;tls-config&quot;,&quot;name&quot;:&quot;&quot;,&quot;cert&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;ca&quot;:&quot;&quot;,&quot;certname&quot;:&quot;&quot;,&quot;keyname&quot;:&quot;&quot;,&quot;caname&quot;:&quot;&quot;,&quot;servername&quot;:&quot;&quot;,&quot;verifyservercert&quot;: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>[{&quot;id&quot;:&quot;6849966e.e53528&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;&quot;,&quot;payloadType&quot;:&quot;date&quot;,&quot;x&quot;:120,&quot;y&quot;:520,&quot;wires&quot;:[[&quot;c8865cec.261cd&quot;]]},{&quot;id&quot;:&quot;c8865cec.261cd&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;Fields&quot;,&quot;func&quot;:&quot;msg.payload = {\\n    intValue: '12i',\\n    numValue: 123.0,\\n    strValue: \\&quot;message\\&quot;,\\n    randomValue: Math.random()*10\\n}\\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;initialize&quot;:&quot;&quot;,&quot;finalize&quot;:&quot;&quot;,&quot;x&quot;:268,&quot;y&quot;:520,&quot;wires&quot;:[[&quot;72bf0ba5.6e63d4&quot;]]},{&quot;id&quot;:&quot;72bf0ba5.6e63d4&quot;,&quot;type&quot;:&quot;influxdb out&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;influxdb&quot;:&quot;2ff2a476.a6d2ec&quot;,&quot;name&quot;:&quot;&quot;,&quot;measurement&quot;:&quot;test2&quot;,&quot;precision&quot;:&quot;&quot;,&quot;retentionPolicy&quot;:&quot;&quot;,&quot;database&quot;:&quot;test&quot;,&quot;precisionV18FluxV20&quot;:&quot;ms&quot;,&quot;retentionPolicyV18Flux&quot;:&quot;&quot;,&quot;org&quot;:&quot;&quot;,&quot;bucket&quot;:&quot;&quot;,&quot;x&quot;:458,&quot;y&quot;:520,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;2ff2a476.a6d2ec&quot;,&quot;type&quot;:&quot;influxdb&quot;,&quot;hostname&quot;:&quot;127.0.0.1&quot;,&quot;port&quot;:&quot;8086&quot;,&quot;protocol&quot;:&quot;http&quot;,&quot;database&quot;:&quot;database&quot;,&quot;name&quot;:&quot;test 1.8 flux&quot;,&quot;usetls&quot;:false,&quot;tls&quot;:&quot;d50d0c9f.31e858&quot;,&quot;influxdbVersion&quot;:&quot;1.8-flux&quot;,&quot;url&quot;:&quot;https:\u002F\u002Flocalhost:8086&quot;,&quot;rejectUnauthorized&quot;:false},{&quot;id&quot;:&quot;d50d0c9f.31e858&quot;,&quot;type&quot;:&quot;tls-config&quot;,&quot;name&quot;:&quot;&quot;,&quot;cert&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;ca&quot;:&quot;&quot;,&quot;certname&quot;:&quot;&quot;,&quot;keyname&quot;:&quot;&quot;,&quot;caname&quot;:&quot;&quot;,&quot;servername&quot;:&quot;&quot;,&quot;verifyservercert&quot;: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: &quot;message&quot;,\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>[{&quot;id&quot;:&quot;15c79e62.9294c2&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;&quot;,&quot;payloadType&quot;:&quot;date&quot;,&quot;x&quot;:120,&quot;y&quot;:560,&quot;wires&quot;:[[&quot;a97b005f.7f22e&quot;]]},{&quot;id&quot;:&quot;a97b005f.7f22e&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;Fields and Tags&quot;,&quot;func&quot;:&quot;msg.payload = [{\\n    intValue: '10i',\\n    numValue: 12,\\n    randomValue: Math.random()*10,\\n    strValue: \\&quot;message2\\&quot;\\n},\\n{\\n    tag1:\\&quot;sensor1\\&quot;,\\n    tag2:\\&quot;device2\\&quot;\\n}];\\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;initialize&quot;:&quot;&quot;,&quot;finalize&quot;:&quot;&quot;,&quot;x&quot;:280,&quot;y&quot;:560,&quot;wires&quot;:[[&quot;a91d522b.9a077&quot;]]},{&quot;id&quot;:&quot;a91d522b.9a077&quot;,&quot;type&quot;:&quot;influxdb out&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;influxdb&quot;:&quot;5d7e54ca.019d44&quot;,&quot;name&quot;:&quot;&quot;,&quot;measurement&quot;:&quot;test&quot;,&quot;precision&quot;:&quot;ms&quot;,&quot;retentionPolicy&quot;:&quot;&quot;,&quot;database&quot;:&quot;test&quot;,&quot;precisionV18FluxV20&quot;:&quot;ms&quot;,&quot;retentionPolicyV18Flux&quot;:&quot;&quot;,&quot;org&quot;:&quot;my-org&quot;,&quot;bucket&quot;:&quot;test&quot;,&quot;x&quot;:510,&quot;y&quot;:560,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;5d7e54ca.019d44&quot;,&quot;type&quot;:&quot;influxdb&quot;,&quot;hostname&quot;:&quot;127.0.0.1&quot;,&quot;port&quot;:&quot;8086&quot;,&quot;protocol&quot;:&quot;http&quot;,&quot;database&quot;:&quot;database&quot;,&quot;name&quot;:&quot;&quot;,&quot;usetls&quot;:false,&quot;tls&quot;:&quot;d50d0c9f.31e858&quot;,&quot;influxdbVersion&quot;:&quot;2.0&quot;,&quot;url&quot;:&quot;https:\u002F\u002Flocalhost:9999&quot;,&quot;rejectUnauthorized&quot;:false},{&quot;id&quot;:&quot;d50d0c9f.31e858&quot;,&quot;type&quot;:&quot;tls-config&quot;,&quot;name&quot;:&quot;&quot;,&quot;cert&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;ca&quot;:&quot;&quot;,&quot;certname&quot;:&quot;&quot;,&quot;keyname&quot;:&quot;&quot;,&quot;caname&quot;:&quot;&quot;,&quot;servername&quot;:&quot;&quot;,&quot;verifyservercert&quot;: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: &quot;message2&quot;\n},\n{\n    tag1:&quot;sensor1&quot;,\n    tag2:&quot;device2&quot;\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>[{&quot;id&quot;:&quot;a67139c7.15ec68&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;&quot;,&quot;payloadType&quot;:&quot;date&quot;,&quot;x&quot;:120,&quot;y&quot;:620,&quot;wires&quot;:[[&quot;15047e0e.e613f2&quot;]]},{&quot;id&quot;:&quot;15047e0e.e613f2&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;name&quot;:&quot;multiple readings&quot;,&quot;func&quot;:&quot;msg.payload = [\\n    [{\\n        numValue: 10,\\n        randomValue: Math.random()*10,\\n        strValue: \\&quot;message1\\&quot;,\\n        time: new Date().getTime()-1\\n    },\\n    {\\n        tag1:\\&quot;sensor1\\&quot;,\\n        tag2:\\&quot;device2\\&quot;\\n    }],\\n    [{\\n        numValue: 20,\\n        randomValue: Math.random()*10,\\n        strValue: \\&quot;message2\\&quot;,\\n        time: new Date().getTime()\\n    },\\n    {\\n        tag1:\\&quot;sensor1\\&quot;,\\n        tag2:\\&quot;device2\\&quot;\\n    }]\\n];\\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;initialize&quot;:&quot;&quot;,&quot;finalize&quot;:&quot;&quot;,&quot;x&quot;:320,&quot;y&quot;:620,&quot;wires&quot;:[[&quot;8caaee80.33352&quot;]]},{&quot;id&quot;:&quot;8caaee80.33352&quot;,&quot;type&quot;:&quot;influxdb out&quot;,&quot;z&quot;:&quot;6256f76b.e596d8&quot;,&quot;influxdb&quot;:&quot;5d7e54ca.019d44&quot;,&quot;name&quot;:&quot;&quot;,&quot;measurement&quot;:&quot;test&quot;,&quot;precision&quot;:&quot;ms&quot;,&quot;retentionPolicy&quot;:&quot;&quot;,&quot;database&quot;:&quot;test&quot;,&quot;precisionV18FluxV20&quot;:&quot;ms&quot;,&quot;retentionPolicyV18Flux&quot;:&quot;&quot;,&quot;org&quot;:&quot;my-org&quot;,&quot;bucket&quot;:&quot;test&quot;,&quot;x&quot;:590,&quot;y&quot;:620,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;5d7e54ca.019d44&quot;,&quot;type&quot;:&quot;influxdb&quot;,&quot;hostname&quot;:&quot;127.0.0.1&quot;,&quot;port&quot;:&quot;8086&quot;,&quot;protocol&quot;:&quot;http&quot;,&quot;database&quot;:&quot;database&quot;,&quot;name&quot;:&quot;&quot;,&quot;usetls&quot;:false,&quot;tls&quot;:&quot;d50d0c9f.31e858&quot;,&quot;influxdbVersion&quot;:&quot;2.0&quot;,&quot;url&quot;:&quot;https:\u002F\u002Flocalhost:9999&quot;,&quot;rejectUnauthorized&quot;:false},{&quot;id&quot;:&quot;d50d0c9f.31e858&quot;,&quot;type&quot;:&quot;tls-config&quot;,&quot;name&quot;:&quot;&quot;,&quot;cert&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;ca&quot;:&quot;&quot;,&quot;certname&quot;:&quot;&quot;,&quot;keyname&quot;:&quot;&quot;,&quot;caname&quot;:&quot;&quot;,&quot;servername&quot;:&quot;&quot;,&quot;verifyservercert&quot;: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: &quot;message1&quot;,\n        time: new Date().getTime()-1\n    },\n    {\n        tag1:&quot;sensor1&quot;,\n        tag2:&quot;device2&quot;\n    }],\n    [{\n        intValue: '11i',\n        numValue: 20,\n        randomValue: Math.random()*10,\n        strValue: &quot;message2&quot;,\n        time: new Date().getTime()\n    },\n    {\n        tag1:&quot;sensor1&quot;,\n        tag2:&quot;device2&quot;\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 &quot;ms&quot; in &quot;Time Precision&quot; of the &quot;Influx Out Node&quot;.  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\" tabindex=\"-1\">\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>[{&quot;id&quot;:&quot;4a271a88.499184&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;87205ed6.329bc&quot;,&quot;name&quot;:&quot;multiple measurement points&quot;,&quot;func&quot;:&quot;msg.payload = [\\n    {\\n        measurement: \\&quot;weather_sensor\\&quot;,\\n        fields: {\\n            temp: 5.5,\\n            light: 678,\\n            humidity: 51\\n        },\\n        tags:{\\n            location:\\&quot;garden\\&quot;\\n        },\\n        timestamp: new Date()\\n    },\\n    {\\n        measurement: \\&quot;alarm_sensor\\&quot;,\\n        fields: {\\n            proximity: 999,\\n            temp: 19.5\\n        },\\n        tags:{\\n            location:\\&quot;home\\&quot;\\n        },\\n        timestamp: new Date()\\n    }\\n];\\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;x&quot;:400,&quot;y&quot;:280,&quot;wires&quot;:[[&quot;748a06bd.675ed8&quot;]]},{&quot;id&quot;:&quot;6493a442.1cdcbc&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;87205ed6.329bc&quot;,&quot;name&quot;:&quot;&quot;,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;&quot;,&quot;payloadType&quot;:&quot;date&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;x&quot;:140,&quot;y&quot;:220,&quot;wires&quot;:[[&quot;4a271a88.499184&quot;]]},{&quot;id&quot;:&quot;748a06bd.675ed8&quot;,&quot;type&quot;:&quot;influxdb batch&quot;,&quot;z&quot;:&quot;87205ed6.329bc&quot;,&quot;influxdb&quot;:&quot;6ca8bde.9eb2f44&quot;,&quot;name&quot;:&quot;&quot;,&quot;x&quot;:670,&quot;y&quot;:220,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;6ca8bde.9eb2f44&quot;,&quot;type&quot;:&quot;influxdb&quot;,&quot;z&quot;:&quot;&quot;,&quot;hostname&quot;:&quot;localhost&quot;,&quot;port&quot;:&quot;8086&quot;,&quot;protocol&quot;:&quot;https&quot;,&quot;database&quot;:&quot;new_db&quot;,&quot;name&quot;:&quot;&quot;,&quot;usetls&quot;:true,&quot;tls&quot;:&quot;f7f39f4e.896ae&quot;},{&quot;id&quot;:&quot;f7f39f4e.896ae&quot;,&quot;type&quot;:&quot;tls-config&quot;,&quot;z&quot;:&quot;&quot;,&quot;name&quot;:&quot;local-tls&quot;,&quot;cert&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;ca&quot;:&quot;&quot;,&quot;certname&quot;:&quot;&quot;,&quot;keyname&quot;:&quot;&quot;,&quot;caname&quot;:&quot;&quot;,&quot;verifyservercert&quot;: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: &quot;weather_sensor&quot;,\n        fields: {\n            temp: 5.5,\n            light: 678,\n            humidity: 51\n        },\n        tags:{\n            location:&quot;garden&quot;\n        },\n        timestamp: new Date()\n    },\n    {\n        measurement: &quot;alarm_sensor&quot;,\n        fields: {\n            proximity: 999,\n            temp: 19.5\n        },\n        tags:{\n            location:&quot;home&quot;\n        },\n        timestamp: new Date()\n    }\n];\nreturn msg;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3 id=\"catching-failed-reads-and-writes\" tabindex=\"-1\">\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\" tabindex=\"-1\">\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",1780684404665]