26 October 2022

Example use of influxdb with node-red

By Bolukan

The node-red node node-red-contrib-influxdb support the transfer of data to influxdb.

Node influxdb: General configuration

Configuration settings:

  • Version: 2.0
  • URL: http://<ip>:8086
  • Token: <your_token>
  • Organization: <your_organization>
  • Bucket: <your_bucket>
  • Time Precision: Seconds (s)

Node influxdb batch: write multiple points

msg.payload: array of points

point: object of

  • measurement: string
  • fields: object of fields
  • tags: object of tags
  • timestamp: datetime

Example for influxdb batch

let msg = { payload: {} };
msg.payload = [

{
measurement: "OnOff",
fields: { action: msg.payload.action },
tags: { protocol: "zigbee", topic: msg.topic },
timestamp: new Date()
}, {
measurement: "Diagnostics",
fields: { linkquality: msg.payload.linkquality.toFixed(0) + "i" },
tags: { protocol: "zigbee", topic: msg.topic },
timestamp: new Date()
}];
return msg;