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

ttb-node-intents

v1.0.9

Published

Intents is a unifying solution between IoT sensors and activators.

Downloads

10

Readme

Intents is a unifying solution between IoT sensors and activators.

Some Node-RED Nodes produce values on the msg flow, some nodes consumes them.

The problem is that there is no definition on how to express something in the flow.

For instance, a zwave library named OpenZWave returns "true" or "false" when a contact sensor is opened or closed.

And the PiFace board expect 0 or 1 on the flow msg payload to turn on its LED.

And the node-red-contrib-lifx for LIFX bulb expects a payload like this one:

{
	payload: {
		on: true,
		hue: 0xCC15,
		...
	}
}

to switch on a bulb.

Thus a function node is mandatory before the node-red-contrib-lifx to "translate" the flow in the expected format and the user has to use javascript just to link a switch to a bulb...

All these connot work together without function nodes that adapts the flow.

The unifying solution: Intents

Intents is a unifying solution between IoT sensors and activators.

For intance, to "open" something (understand switching a light on, turning a radio on...) the msg should contain msg.intent=1.

The intents library

Notice that these intents are never mandatory: they may exist or not.

intent intent

Some intents are coded as integers into the msg.intent.

The following intents are defined:

  • Open/switch On msg.intent=1

  • Close/switch Off msg.intent=0

  • Invert: this changes close to open and vice et versa.

  • More msg.intent=2. Use this intent to add more sound, more light...

  • Less msg.intent=3

  • NoIntent: in this case, msg.intent === undefined

  • Color msg.color allows to set a RGBW value from a color panel

  • Intensity: allow to set a value between 0 and 100 with a slider

There are nodes in the palette for each intents. They allow to set an intent on the flow without having to use a javascript function.

The nodes open, close, more, less set the intent into the message flow.

intent picture

If a picture is in the flow, it's absolute OS pathname should be in msg.picture.

This is done by nodes camera, picturepicker and node ledmatrix use it.

intent colors

If a color is in the flow, it's value should be in msg.color.

intent city

If a city is in the flow, it's value should be in msg.city.

intent message

The payload is dedicated to the next node in the flow. Use msg.message to set a payload equivalent message dedicated to human.

A temperature node ouputs the folowing msg:

{
payload: "20.7",
message: "The temperature of the office is 20.7 oC"
}

The Display node is intent aware: it displays the msg.message instead of the payload if it exists. But the MQTT-out node sends the payload to the broker.

intent battery

Contains the battery level as integer.

intent updated

contains the date on which the message was created.

Sample

Here is an example where the same intents are used to monitor both a sound and a hue bulb: the open starts the sound and switch on the light. Same for close. Also the intensity node sets the level of the sound as well as the intensity of the light at the same time:

Avanced

Nodes should handles intents form the more specific to the less. For instance, a sound node should search its parameter into the "sound" track first, then the "value" then the "payload".