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

v1.2.0

Published

A timer node for node-red which can be controled with json messages

Downloads

39

Readme

Use this to set timers to alarm at a specific time

This node has following properties:

  • name: The name of the node
  • locale: This is the default locale to use for to the "localeDateTime" output propterty. (see toLocaleString)
  • localeOptions: This is the locale options object to use for to the "localeDateTime" output propterty. (see toLocaleString)

Input

Set topic to 'set' to set a timer or 'clear' to clear an existing timer or 'list' to list all timers.

Following payload properties can be used:

  • id: Specify the id for the timer. Can be used to clear it and will be set on events.
  • One of following time settings:
    • timeout: A relative timeout value in milliseconds when timer should trigger.

    • datetime: An absolute unixtimestamp in milliseconds when timer should trigger.

    • time: An absolute timer object with following properties.

      • hours: hour value of time to trigger the timer. Default 0

      • minutes: minute value of time to trigger the timer. Default 0

      • seconds: second value of time to trigger the timer. Default 0

      • milliseconds: millisecond value of time to trigge the timer. Default 0

        e.g.: For 22:13:36.010 specifiy { "hours": 22, "minutes":13, "seconds":36, "milliseconds": 10}

  • locale: Specify a locale to use to add a "localeDateTime" propterty to the output. It will override the default. (see toLocaleString)
  • localeOptions: Specify options object for locale to use to add a "localeDateTime" propterty to the output. It will override the default. (see toLocaleString)
  • alarmPayload: Specify the payload for the alarm event.

Events

Topic property will contain one of following values:

  • settime: when time was set
  • clearedtime: when time was cleared
  • list: will contain a property 'timers' which is an array with each timer currently active
  • alarm: when timer triggered
  • error: when an error occured during setting of timer

example

Example flow:

[{"id":"ec99b4da.293d4","type":"tab","label":"jsontimer example","disabled":false,"info":""},{"id":"7279d624.7be1e","type":"jsontimer","z":"ec99b4da.293d4","name":"","locale":"en-GB","localeOptions":"","x":440,"y":200,"wires":[["f7b7a7a8.610e08"],["abb7e0fe.204fe8"]]},{"id":"f7b7a7a8.610e08","type":"debug","z":"ec99b4da.293d4","name":"timerout","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":620,"y":160,"wires":[]},{"id":"781c568e.7274d","type":"inject","z":"ec99b4da.293d4","name":"20 seconds","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"set","payload":"{\"id\":\"This is a test\",\"timeout\":20000}","payloadType":"json","x":210,"y":200,"wires":[["7279d624.7be1e","af6927b1.cf26b"]]},{"id":"af6927b1.cf26b","type":"debug","z":"ec99b4da.293d4","name":"timer in","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":120,"wires":[]},{"id":"65d3a29.abf2fdc","type":"inject","z":"ec99b4da.293d4","name":"Clear 20 seconds timer","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"clear","payload":"{\"id\":\"This is a test\"}","payloadType":"json","x":180,"y":240,"wires":[["7279d624.7be1e","af6927b1.cf26b"]]},{"id":"dd59dba0.990e4","type":"inject","z":"ec99b4da.293d4","name":"9:20:36","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"set","payload":"{\"id\":\"This is a test\",\"time\":{\"hours\":9,\"minutes\":20,\"seconds\":36},\"locale\":\"sv\"}","payloadType":"json","x":230,"y":100,"wires":[["7279d624.7be1e","af6927b1.cf26b"]]},{"id":"c4ca6c73.9a36a","type":"inject","z":"ec99b4da.293d4","name":"20 seconds with alarmPayload","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"set","payload":"{\"id\":\"This is a test\",\"timeout\":20000,\"alarmPayload\":{\"test\":\"This is a test\"},\"locale\":\"nl-NL\"}","payloadType":"json","x":160,"y":160,"wires":[["7279d624.7be1e","af6927b1.cf26b"]]},{"id":"de1f5c99.ee56e8","type":"inject","z":"ec99b4da.293d4","name":"list","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"list","x":230,"y":280,"wires":[["7279d624.7be1e","af6927b1.cf26b"]]},{"id":"237f8783.835e5","type":"inject","z":"ec99b4da.293d4","name":"22:10:30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"set","payload":"{\"id\":\"This is test 2\",\"time\":{\"hours\":22,\"minutes\":10,\"seconds\":30},\"locale\":\"nl-NL\",\"localeOptions\":{\"timeZone\":\"UTC\"}}","payloadType":"json","x":220,"y":60,"wires":[["7279d624.7be1e","af6927b1.cf26b"]]},{"id":"abb7e0fe.204fe8","type":"debug","z":"ec99b4da.293d4","name":"alarmPayload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":640,"y":200,"wires":[]}]