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-tag-engine

v0.3.2

Published

Tag-Engine is a set of Node-Red nodes, that will Observes tags for a change and executes a listener's function.

Downloads

128

Readme

Tag Engine Node for Node-RED

The Tag Engine Node for Node-RED is a set of nodes that allow seamless integration of the Tag Engine library into Node-RED flows. These nodes enable users to interact with tags and tag groups directly within Node-RED, facilitating the management of tag values and the emission of events to subscribers.

Introduction

The Tag Engine Node for Node-RED provides two custom node types: cx_tags_in and cx_value_emitter. These nodes allow users to interface with tag groups, set tag values, and emit events based on tag changes directly within Node-RED.

Node Types

cx_tags_in

The cx_tags_in node allows users to set tag values programmatically within Node-RED flows. It receives input messages containing tag values and updates the corresponding tags in the Tag Engine. Users can configure this node to handle individual tag updates or batch updates for multiple tags simultaneously.

cx_value_emitter

The cx_value_emitter node emits tag values as output messages within Node-RED flows. Users can configure this node to emit tag values on startup, in response to input messages, or based on specific conditions. This node is useful for integrating tag values into downstream processing logic within Node-RED.

Installation

To install the Tag Engine Node for Node-RED, follow these steps:

  1. Ensure you have Node-RED installed and running.

  2. Install the tag-engine library using npm:

npm install cx-tag-engine
  1. Install the Tag Engine Node for Node-RED using npm:
npm install node-red-contrib-tag-engine

Usage

After installing the Tag Engine Node for Node-RED, you can use the cx_tags_in and cx_value_emitter nodes like any other Node-RED nodes. Simply drag and drop them onto your Node-RED flow canvas and configure their properties as needed.

Properties

cx_tags_in Node:

  • Group: The name of the tag group to which the tag belongs.
  • Tags Batch: If checked, input of the cx_tags_in should be a map which mapping tag names to their values.
  • Tag Name: The name of the tag to be updated or emitted.
  • Force Emit: If checked, the cx_tags_in node will emit an event even if the tag value is not changed.
  • Flush Time: The time interval (in milliseconds) at which the tag should save to database. Value will only be kept in memory if this flush time is set to 0.

cx_value_emitter Node:

  • Emit On Start: If checked, the cx_value_emitter node will emit tag values on startup.
  • Emit All Changes in Group: If checked, the cx_value_emitter node will emit all tag values in the specified group when any tag value changes.
  • Group Payload: If checked, the output message will contain the group name in the payload.
  • Tag List:
    • Prevent Emit on Change: If checked, the cx_value_emitter node will not emit an event when the tag value changes but the output will contain this tag's value if other tag value changes.

Input of cx_tags_in Node

// single tag
payload: number | boolean | string

// multiple tags if Tags Batch is checked
payload: {
  tagName1: number | boolean | string,
  tagName2: number | boolean | string
}
// Additional data can be send in metadata which will be used by the backend, but this will not be saved in database
{
    metadata: {
        // other data
    },
    payload: number | string | boolean | object
}

Output of cx_value_emitter Node

// single tag
{
    payload: number | string | boolean | object
}

// multiple tags
{
    payload: {
        tagName1: number | string | boolean | object | null
        tagName2: number | string | boolean | object | null
    }
}

// grouped payload
{
    payload: {
       groupName1: {
           tagName1: number | string | boolean | object | null
           tagName2: number | string | boolean | object | null
       },
       groupName2: {
           tagName3: number | string | boolean | object | null
         tagName4: number | string | boolean | object | null
       }
    }
}

Environment Variable

Tag Engine supports the utilization of environment variables within group names and tag names. This feature proves particularly beneficial in subflows. For instance, if you've configured an environment variable named index within the properties of a subflow, you can employ ${index} within the group name or tag name to dynamically reference its value.

Util

In NodeRED function node, you can use the following code to get the tag or its value.

const value = RED.util.cxGetTagValue(groupName, tagName)
const tag = RED.util.cxGetTag(groupName, tagName)