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

@mschaeffler/node-red-logic

v3.0.1

Published

nodes for simple operations.

Downloads

339

Readme

@mschaeffler/node-red-logic

Nodes to perform boolean and arithmetic operations on input signals.

image of nodes

If the msg property invalid is present in the message, all nodes ignore the message.

Install

$ npm install @mschaeffler/node-red-logic

Boolean Nodes

image of example flow

to bool

Converts payload to a bool value:

|type|value|is converted to| |:---|:----|:--------------| |bool|false|false| ||true|true| |number|0|false| ||1|true| |string|false|false| ||0|false| ||off|false| ||true|true| ||1|true| ||on|true|

Input

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |payload | | input value. |

Output

|msg. | type | description | |:-------|:-------|:----------------------------------| |payload | boolean | bool value of payload.|

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Property| string | defines the message property to be used as payload.| |Status|boolean|shows the actual value as a node status.|

or

Combines two or more boolean vales with the or operator.

The input values are converted as described in the to bool node.

Input

The different inputs are differentiated by topics.

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |topic | string | name of the input channel. | |payload | boolean| input value for topic. |

Output

|msg. | type | description | |:-------|:-------|:----------------------------------| |payload | boolean | result of or of all input topics.| |count | number | number of data elements.|

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Topic | string | defines the topic for the output message.| |Property| string | defines the message property to be used as payload.| |min. Data|number|min. amount of topics to generate an output.|

and

Combines two or more boolean vales with the and operator.

The input values are converted as described in the to bool node.

Input

The different inputs are differentiated by topics.

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |topic | string | name of the input channel. | |payload | boolean| input value for topic. |

Output

|msg. | type | description | |:-------|:-------|:----------------------------------| |payload | boolean | result of and of all input topics.| |count | number | number of data elements.|

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Topic | string | defines the topic for the output message.| |Property| string | defines the message property to be used as payload.| |min. Data|number|min. amount of topics to generate an output.|

Integer Nodes

image of example flow

counter

A node that just count the messages.

Output

|msg. | type | description | |:-------|:-------|:----------------------------------| |count | number | number of messages.|

to number

Converts payload to a number.

Input

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |payload | | input value. |

Output

|msg. | type | description | |:-------|:-------|:----------------------------------| |payload | number | number value of payload.|

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Property| string | defines the message property to be used as payload.| |Status|boolean|shows the actual value as a node status.|

reduce

Combines two or more streams of data (topics) into one single value.

Each stream can be debounced by arithmatic mean.

Input

The different inputs are differentiated by topics.

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |topic | string | name of the input channel. | |payload | number | input value for topic. |

Output

|msg. | type | description | |:-------|:-------|:----------------------------------| |payload | number | result of combining of all input topics.| |count | number | number of data elements.|

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Topic | string | defines the topic for the output message.| |Property| string | defines the message property to be used as payload.| |min. Mean|number|min. amount of values for the arithmatic mean of one topic.| |max. Mean|number|max. amount of values for the arithmatic mean of one topic.| |min. Data|number|min. amount of topics to generate an output.| |Algorithm|string|algorithm to combine the values.|

Algorithms

|algorithm|description| |:--------|:----------| |add |ads up the topic channels| |mean |averages the topic channels| |prod |multiplies the topic channels| |min |gets the minimal value of the topic channels| |max |gets the maximal value of the topic channels|

statistics

Calculate statistical values of one or more data streams.

Each stream can be debounced by arithmatic mean.

If the msg property invalid is present in the message, all nodes ignore the message.

Input

The different inputs are differentiated by topics.

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |topic | string | name of the input channel. | |payload | number | input value for topic. |

Output

|msg. | type | description | |:-------|:-------|:----------------------------------| |payload | | same as in input message.| |stats.count | number | number of data elements.| |stats.min number | number | minimal value.| |stats.max number | number | maximal value.| |stats.average number | number | average value.| |stats.deviation number | number | standard deviation.| |stats.variation number | number | coefficient of variation.|

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Property| string | defines the message property to be used as payload.| |delta time|number|time frame to collect the data for the analysis.| |min. Data|number|min. amount of data points to generate an output.|

Edge Nodes

image of example flow

fallingEdge

Message is only forwarded, if the payload falls below a threshold value.

Each topic is treated seperatly.

Input

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |topic | string | name of the input channel. | |payload | number | input value for topic. |

Output

Trigger message, in case a falling edge is detected.

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Property| string | defines the message property to be used as payload.| |Threshold|number|threshold value for the edge detection.| |Status|boolean|shows the actual value as a node status.|

raisingEdge

Message is only forwarded, if the payload raises above a threshold value.

Each topic is treated seperatly.

Input

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |topic | string | name of the input channel. | |payload | number | input value for topic. |

Output

Trigger message, in case a raising edge is detected.

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Property| string | defines the message property to be used as payload.| |Threshold|number|threshold value for the edge detection.| |Status|boolean|shows the actual value as a node status.|

hysteresis

Message is only forwarded, if the payload raises above an upper limit or falls below a lower limit.

Each topic is treated seperatly.

Input

The message property to be used as payload can be defined with the Property property.

|msg. | type | description | |:-------|:-------|:----------------------------------| |topic | string | name of the input channel. | |payload | number | input value for topic. |

Output

Trigger message, in case an edge is detected.

Parameters

|config| type | description | |:-----|:-------|:----------------------------------| |Property| string | defines the message property to be used as payload.| |up Threshold|number|threshold value for the raising edge detection.| |d(ow)n Threshold|number|threshold value for the falling edge detection.| |1st message|string|initial behaviour (None, Rising, Falling, Any).| |Status|boolean|shows the actual value as a node status.|

Example Flows

boolean nodes

integer nodes

edge nodes

Author

Mathias Schäffler

Contributors

for falling edge, raising edge and hysteresis:

License

LGPL-2.1