Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including node-red-node-suncalc with all npm packages installed. Try it out:

node-red-node-suncalc lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("node-red-node-suncalc/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

node-red-node-suncalc v0.0.11

A Node-RED node to provide a signal at sunrise and sunset

node-red-node-suncalc

A Node-RED node to provide a signal at sunrise and sunset.

Install

Run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-node-suncalc

Usage

Uses the suncalc npm to generate an output at sunrise and sunset based on a specified location.

Several choices of definition of sunrise and sunset are available, see the suncalc module for details.

The node provide two outputs. The first output emits a msg.payload of 1 or 0 every minute depending if day-time (1) or night-time (0).

The second output emits only on the transition between night to day (-> 1) or day to night (-> 0).

It also sets the msg.topic to sun and msg.moon to the fraction of the moon currently visible (a value between 0 for no moon and 1 for full moon).

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free