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-relay

v1.0.1

Published

A Node-RED node that mimics relay logic.

Downloads

49

Readme

Relay Node for Node-RED

This module provides a simple relay node for Node-RED. It allows you to control the flow of messages based on an "enable" or "disable" signal received on a specific topic.

Installation

  1. Download this module or clone the repository.
  2. In your Node-RED user directory, run:
npm install .

or install it online as

npm install node-red-contrib-relay

Usage

  1. Add a "relay" node to your flow.
  2. Configure the following properties:
    • name: A name for the node (optional).
  3. Use "enable" and "disable" messages on the specified topic to control the node's behavior:
    • Topic: Set the topic to use for control messages (default: "control").
    • Enable: Send a message with payload: true on the topic to enable the node.
    • Disable: Send a message with payload: false on the topic to disable the node.
  4. Connect the output of the node to other nodes in your flow.

Example:

[{"id":"64be663cf0206851","type":"tab","label":"relay","disabled":false,"info":"","env":[]},{"id":"525f10ada286a70a","type":"comment","z":"64be663cf0206851","name":"Relay Logic Node","info":"","x":150,"y":40,"wires":[]},{"id":"9ee575d0754121d8","type":"inject","z":"64be663cf0206851","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":150,"y":260,"wires":[["d970975b7e294254"]]},{"id":"1ac3ad5411372426","type":"inject","z":"64be663cf0206851","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":150,"y":320,"wires":[["dc289e3e44dd7d49"]]},{"id":"d970975b7e294254","type":"change","z":"64be663cf0206851","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"enable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":260,"wires":[["b029a528116775e2"]]},{"id":"dc289e3e44dd7d49","type":"change","z":"64be663cf0206851","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"disable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":320,"wires":[["b029a528116775e2"]]},{"id":"63a9df9c35bd02a4","type":"inject","z":"64be663cf0206851","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":400,"wires":[["b029a528116775e2"]]},{"id":"b029a528116775e2","type":"relay","z":"64be663cf0206851","name":"relay","x":530,"y":320,"wires":[["ca1ee575c701829a"]],"icon":"node-red/inject.svg"},{"id":"ca1ee575c701829a","type":"debug","z":"64be663cf0206851","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":750,"y":320,"wires":[]}]

In this example, the "inject" node sends a message with payload: true on the topic "control" to enable the relay node. This allows any message received at the relay node's input to be passed through to its output.

Notes

  • The node checks the message topic and payload to determine whether to enable or disable message forwarding.
  • The node's status reflects its current state (enabled/disabled).

Author

  • Harshad Joshi @ Bufferstack.IO Analytics Technology LLP, Pune

Contributing

We welcome contributions to this project. Feel free to submit pull requests with improvements or bug fixes.