npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-stackhero-influxdb-v2-param

v1.0.5

Published

A Node-RED node to connect to an InfluxDB v2 database based on stackhero module.

Downloads

32

Readme

node-red-contrib-stackhero-influxdb-v2

Node-RED node to read and write to an InfluxDB v2 database.

Remember: if you like it, please star it! 🥰

Official repository: https://github.com/stackhero-io/node-red-contrib-stackhero-influxdb-v2

Sponsors

node-red-contrib-stackhero-influxdb-v2 is developed by Stackhero. If you are looking for powerful managed services, like InfluxDB, you should seriously consider Stackhero 🤓

Usage

We have 2 nodes here. A write node, to send data to InfluxDB and a query node, to retrieve data using the Flux language.

Write data

The write node requires a payload object like this one:

msg.payload = {
  // You bucket
  // Optional (it can be defined in the node credentials settings)
  bucket: 'myBucket',

  // Precision of timestamp
  // Optional
  // Can be `ns` (nanoseconds),
  //        `us` (microseconds),
  //        `ms` (milliseconds),
  //        `s` (seconds).
  // The default is `ns`
  // Note: if you set the `timestamp` field to `Date.now()`, you have to set the `precision` to `ms`
  precision: 'ms',

  // Data to send to InfluxDB
  // Can be an array of objects or only one object
  data: [
    {
      measurement: 'machinerySensor',

      tags: {
        deviceId: 'gyh43',
        hardwareVersion: '1.0.2',
        softwareVersion: '2.5.1',
        location: 'factory-1'
      },

      fields: {
        temperature: 12,
        humidity: 46,
        vibrations: 18,
        batteryVoltage: 3.6
      },

      timestamp: Date.now()
    },

    // More data can be send here, simply re add an object
    // { ... },
  ]
};

return msg;

Example of the write node

Query data

The query node requires a topic string containing a Flux query.

msg.topic = 'from(bucket: "myBucket") |> range(start: -1h)';
return msg;

You can write multiple lines queries like this:

msg.topic = [
  'from(bucket: "myBucket")',
  '  |> range(start: -1d, stop: now)',
  '  |> filter(fn: (r) => r._measurement == "machinerySensor")',
  '  |> filter(fn: (r) => r._field == "vibrations")',
  '  |> aggregateWindow(every: 1h, fn: mean)',
  '  |> yield(name: "mean")',

  'from(bucket: "myBucket")',
  '  |> range(start: -1d, stop: now)',
  '  |> filter(fn: (r) => r._measurement == "machinerySensor")',
  '  |> filter(fn: (r) => r._field == "vibrations")',
  '  |> aggregateWindow(every: 1h, fn: max)',
  '  |> yield(name: "max")',
].join('\n');

return msg;

Example of the query node