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 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-rate

v1.4.0

Published

A node-red node to calculate the rate of change for a message property.

Readme

node-red-contrib-rate

A Node-RED node for calculating the rate of change of a message property.

Rates of change are calculated based on the message property (msg.topic), so multiple topics can be passed through the node to calculate the individual rates of change for each topic. The timebase can be chosen from system time (i.e. actual time of Node-RED) or to a timestamp given in the message containing the evaluated message topic.

node-appearance
Fig. 1: Node appearance

Installation

In Node-RED (preferred)

  • Via Manage Palette -> Search for "node-red-contrib-rate"

In a shell

  • go to the Node-RED installation folder, e.g.: ~/.node-red
  • run npm install node-red-contrib-rate

Usage

Node Configuration

node-settings
Fig. 2: Node properties (example hysteresis node)

Input

The input data to which the rate calulation refers can be selected to be a msg property, or a flow resp. global variable.
With this option to choose the input property of a msg input, several rate nodes may be used in parallel (i.e. inputs connected to the identical node output) to get the rate of different properties of the same messages.

Rate

This is the output property name into which the node puts its rate calculation result for the chosen Input variable. This Rate property denotes the data at the nodes output messages.

Timestamp

The rate of change of the Input property data is related to a time (see also Rate Period below). It is calculated from the datapoints given by [Input property; Timestamp property].

The Timestamp configuration describes instant of time to which the rate of change is related to:

  • Now uses the current system time in milliseconds.
  • A property from the incoming msg, a flow or a global variable could be used for timestamping the input data.

Rate Period

Rate Period specifies the number of timestamp units the rate of change is related.
For example, if the timestamp is in milliseconds, Rate Period of 1000 would calculate the rate of change per second.
See also Example 1.

See also Fig. 3: The shorter the Rate Period value is, the smaller the output msg.rate will be.

Fig. 3: Rate Period

Input

The input data will be taken from the incoming msg. It is possible to measure the rate of several values (properties) of an incoming msg, therefor the node configuration property Input is present.

Fig. 4: Evaluating several values from the same msg

Input data values with own timestamp
If you have input messages containing their own timestamp information (e.g. because the data and timestamp were generated by a value latching instance) the rate of change can be evaluated by using the message timestamp data as the Timestamp node configuration property. To achieve this, change the Timestamp node configuration property to the input msg.property where the timestamp value is located.

Input data conversion
The format of the input data will be converted as possible. You may also use mixed input data types, e.g. numbers or strings with the same rate node. This could be the case if the rate node is fed from different source nodes with different Input formats (like shown in Example 2).

Output

The output is the rate of change of the Input data. It can be routed to any output.msg property, this is configured via the node configuration property Rate.

Examples


Remark: Example flows are present in the examples subdirectory. In Node-RED they can be imported via the import function and then selecting Examples in the vertical tab menue.


Example 1: Measuring the system timestamp

This example measures the timestamp of the system. The result should be a constant rate. Depending on the Rate Period value you get different rates due to a different measurement time references.
Change the Rate Period of the rate node and examine what happens!

TimestampMeasuringFlow.json

Fig. 5: Timestamp measuring example

Example 2: Measuring value changes

ValueMeasuringFlow.json

Fig. 6: Value measuring example