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-countdown-2

v1.4.2

Published

A countdown that supports dynamic setting of (future) run time and stopping with or without payload output

Downloads

296

Readme

node-red-contrib-countdown

node-red-contrib-countdown-2 is a simple countdown node. It starts a countdown timer on a received input msg and decreases the counter value (at the first output) until the countdown timer elapses. The countdown can be stopped at any time. Also the countdown timer can be set to any new countdown value at any time to reload the timer with a specific value. manual stopped can be configured to send output or cancel which does not send output payloads.

The output can emit a msg at its first output with an arbitrary msg.payload contents at the start of the timer as well as at the stop of the countdown timer. or nothing if cancled timer. At the second Output the node emits the remaining counter value every second.

The node's output msg can optionally contain an arbitrary topic string.

Forked from Ontje: https://github.com/ontje/node-red-contrib-countdown.git Thank you!

node-appearance
Fig. 1: Node appearance

Installation

In Node-RED (preferred)

  • Via Manage Palette -> Search for "node-red-contrib-countdown-2"

In a shell

  • go to the Node-RED installation folder, e.g.: ~/.node-red
  • run npm install node-red-contrib-countdown-2

Usage

Node Configuration

node-settings
Fig. 2: Node properties

Countdown (secs) property

Set the Countdown value to the desired countdown time in seconds. The timer will start with this countdown value to decrease the timer value (countdown start value). Minutes if the option "Counter is in Minutes" is checked.

Topic

The Topic can be set to any string value. This string is added to the output msg as an additional element msg.topic.

Note: No value is given to the topic.

Timer On payload, Timer Off payload

Set the Timer On payload to any payload type and value which is sent when the counter starts.
Set the Timer Off payload to any payload type and value which is sent when the counter elapses.
In both cases, also nothing to be emitted may be chosen.

Flags

You can configure the timer to

  • Timer in Minutes (default is seconds)
  • restart (reload) the timer to its countdown start value during the count down whenever a msg is received at the node's input.
  • activate the ability to set the timer value to an arbitrary value during the count down with the use of a control msg.
  • start the timer with a control msg (i.e. a msg with a control topic string).

Input

The node evaluates the following input msg types:

  • Input msg with a msg.payload contents of false (boolean) or '0' (number).
    This msg type stops resp. finishes the timer. The Timer Off payload is emitted also in this case.
  • Input msg with a msg.topic set to "control" and a msg.payload set to an arbitrary number value. This reloads the timer with the desired msg.payload value immediately and works at a running countdown as well as a non startet or elapsed countdown timer.
  • All other input msg do start/restart the timer if it is stopped.
  • See Node configuration for control topic options to cancel the timer.

Outputs

The node contains two outputs:

  • The primary output (upper output) emits an output msg at the countdown start/stop instant of time. These msg.payload contents are configurable
  • The secondary output (lower output) emits the remaining time every second during the timer runs. The msg.payload holds the remaining counting value

Examples (original)

Todo: create examples for modified control/stop/etc.

Basic behaviour

This example shows the basic behaviour with

  • starting the timer via an input msg (inject node)
  • showing the behaviour of the two outputs of the node

Just activate the inject and look at the output debug node status messages.

Alt text
basic flow
Fig. 3: Basic example flow

Sending messages and retriggering

This example shows how to

  • handle messages at the start and the end of the countdown
  • retrigger the timer during it runs

Text messages are output on the first output at start and end of the countdown.
You can restart the timer by activating the inject node during the countdown runs.

Alt text
messages and retriggering flow
Fig. 4: Message sending and retriggering example flow

Stopping the countdown timer

This example shows the two options to stop the countdown timer.

Alt text
stopping timer flow
Fig. 5: Timer stopping example flow

Reloading the countdown timer

This example shows the functionality of reloading the countdown value during a running timer.

Alt text
reloading timer flow
Fig. 6: Timer reload example flow