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-value-for

v0.3.4

Published

A Node-RED node to report if sensor stream values are in given value or range for defined time.

Downloads

325

Readme

This package provides two nodes that compare string or numeric values to message payloads. If input string equals configured value or input value is in configured range - starts timer for configured period of time. If input value won't excurse from configured for given period of time – will trigger single message to 1st output. 2nd output is used for reporting reset.

Installation

npm install node-red-contrib-value-for

About

This nodes can be used to listen if reported sensor values are in configured range for given period of time, and if yes - report that fact on output.

This library is similar to (and inspired by) node-red-contrib-edge-trigger which you can use to listen for numeric value change "over", "below" or "out of range", but you cannot listen to value change "inside the range" or string input. node-red-contrib-value-for also adds for parameter to listen if value haven't excursed from configured range/value for given period of time.

This nodes always does nothing after receiving just a first/single message. It works only as a comparator on message receival.

Usage

range-for

Takes above and/or below numeric values to describe a values range. Once input value matches the range, starts a timer with given for period. If incoming input values won't excurse from that range – will trigger single output after configured period.

Any input value that excure from configured range or input msg.payload = "reset" will reset the timer and trigger a second output once.

range-for node

value-for

Takes value string to compare with incoming message payload. Once input value matches configured value, starts a timer with given for period. If incoming input values won't change from that value – will trigger single output after configured period.

Any input value different from configured value or input msg.payload = "reset" will reset the timer and trigger a second output once.

Values are compared as strings! Therefor you can choose to make case (in)sensitive matching.

value-for node

fixed-for

This node compares current value on input with previous value sent to input. If value won't change for given period of time – node will trigger first output.

Normally this node waits for first input message to start comparison timer. You can optinally select to start comparison timer on node (re)deployment, so if no message at all will hit node input – it will also trigger first output. This is helpful for critical messages that must be compared even on i.e. NodeRED restart.

Values are compared as strings! Therefor you can choose to make case (in)sensitive matching.

fixed-for node

Generic options

You can configure nodes to report just once after the range/value matched configuration or report continously starting new timers each time a value confirming match in range/value is incoming as input. New timer will start only if new message comes in!

Changelog

0.3.4

  • Improved node status texts

0.3.3

  • Fixed fixedfor for empty string and null values

0.3.2

  • Removed console.logs

0.3.0

  • Added fixed-for node.
  • Small typo fixes.

0.2.2

  • Improved node status output.

0.2.1

  • Fixed config values not being parsed as Numbers that resulted in comparison of Number vs String.
  • Improved node status output.

0.2.0

  • Fixed some values above "below" triggering in_range.
  • Added msg.payload to return last reported value.
  • Added msg.reset = 1 to 2nd output and also msg.payload to return last reported value.

0.1.2

  • Changed nodes color to violet.

0.1.1

  • Minor bugs fixed.

0.1.0

  • Initial version.