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

co-api

v1.0.0

Published

CamOverlay NodeRed package.

Downloads

32

Readme

NodeRed boxes

  • enable-stream: enables/disables configured stream of CamStreamer
  • enable-service: enables/disabls configured service of CamOverlay
  • update-cg-text: updates selected fields in Custom Graphics service of CO
  • update-cg-image: updates/repositions background image in Custom Graphics of CO
  • update-infoticker: updates text in Infoticker service from selected source

AXIS NodeRed

Now you can run NodeRed also directly on your camera. Click here to get the NodeRed AXIS package.

How to make Node Red Box in 24 hours or less

npm package

To be able to add boxes to node-red first you have to create directory with package.json. One of the package's keyword has to be "node-red". This will enable node-red to access it once your package is published on npm. package.json should also have a property "node-red" which contains object with property "nodes". "nodes" then contains object containing relative paths to .js files of each node referenced by name of each node. It is not clear yet to the author of this documentation how this translates to actual functionality.

AXIS Node-Red Testing

While on computer one can use npm utility to install one's own node-red packages localy but when running Node-Red on Axis camera, no such option is available.

It is however possible to upload .tgz file through browser interface.

To obtain .tgz archive with the right structure type npm pack while in your package repository.

Node Contents

See Node-RED documentation.

How am I supposed to understand this???????

Don't panic. Here we'll cover topics rather scattered or enterily omitted in the official documentation!

Typed Input

As the official documentation states, to create typed input you must first create alternative input for your example input like so:

<input  type="text"  id="node-input-example3">
<input  type="hidden"  id="node-input-example3-type">

then you edit the configurating javascript. Official documentation uses following example:

$("#node-input-example3").typedInput({
	type:"msg",
	types:["msg", "flow","global"],
	typeField:  "#node-input-example3-type"
})

What won't NodeRed tell you

The provided example doesn't really work as expected. Instead of setting up typed input once and for all, it will rewrite the input type every time user opens the edit window as it never stored anywhere.

To ensure more lasting setup you have to connect the type input (connecting the actual data input is not enough!!!) to a standard (default) input of your node. This also provides you with the precious information about which data type are you recieving in your node's runtime as it is not indicated otherwise!

This is also much easier done if the input's variable name is valid JSON variable name, unlike in the official doc:

<input  type="text"  id="node-input-example3">
<input  type="hidden"  id="node-input-example3_type">

and consequently:

$("#node-input-example3").typedInput({
	type:"msg",
	types:["msg", "flow","global"],
	typeField:  "#node-input-example3_type"
})

It is crucial to note that typed input has nothing to do with types of input in default section of your node's configuration.

Those types are actually types of configuration nodes available in your node-red project.

It's all fairly straightforward.

Editable List

Documentation for editable list widget can be found here. Still confused? Don't worry and read on...

How exactly do I get the data?

As the official documentation is not concerned with such earthly worries as using user input in the runtime of your node, here are few tips how to get that pesky data to your node after all:

  • Tip #1 Variables. The default input variables of your node can be accessed during the edit phase in similar fashion as during runtime. It is not yet clear to author of this documentation whether such data passed via this method go through any validation process if provided in node's configuration. Likely no.

  • Tip #2 Use Callbacks. The official documentation provides us with several callback function that may trigger during user interaction with your node's edit screen. The most important here are:

    • oneditprepare triggers before the edit screen is rendered. if you wish to display some saved data, here's your chance.

    • oneditcancel: same as oneditsave but trigger when you cancel your changes.

    • oneditsave: triggers after you save the node. Does not overwirite default mapping of inputs to variables but might be able to overwrite already mapped value stored in a variables.

Example:


RED.nodes.registerType('example',{
	defaults: {
		name: {value:""},
		variable_of_interest:{value:"yadayadayada"}
	},
	oneditsave:  function (){
		this.variable_of_interest = $('#more_sophisticated-text-input').val();
	},
	...
	...
});

Best Practices

  • If part of your NodeRED API consists of accessing lasting service set up an overarching config node

  • Sometimes less is more, sometimes more is more. Greater variety of specialised nodes might be more comprehensible to user than one big do-all blackbox.

  • For storing instances create init nodes that pass them into flow context (or wherever is the user most comfortable with).

  • Config nodes are harder to debug as they can't be watched by built-in error catcher. Thus generaly they should contain plain information only.

  • In runtime boxes important instances should be created outside input event callback and only used in the callback. Use node's context for this.