node-red-nodes/time/suncalc
Sam Machin 2d28a2304f
Update package.jsons for mono-repo (#851)
Update the package.json for each node to point to the directory within the repo that hosts the code for the package in question.  as per https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository
2021-11-02 15:22:30 +00:00
..
icons Start making non-red-nodes tolerant to missing payloads 2015-03-31 13:18:25 +01:00
locales/en-US added i18n help files (#766) 2021-03-12 13:17:23 +00:00
79-suncalc.html added i18n help files (#766) 2021-03-12 13:17:23 +00:00
79-suncalc.js suncalc - add moon position and phases, and sun position - bump to 1.0 2020-04-30 11:11:11 +01:00
LICENSE Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
README.md suncalc - add moon position and phases, and sun position - bump to 1.0 2020-04-30 11:11:11 +01:00
package.json Update package.jsons for mono-repo (#851) 2021-11-02 15:22:30 +00:00

README.md

node-red-node-suncalc

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

Install

Either use the Node-RED Menu - Manage Palette - Install, or run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-node-suncalc

Breaking Change - in version 1.0 the msg.moon property is now an object not a number - containing a lot more information.

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 start and end times can be offset by a number of minutes before (minus) or after (plus) the chosen event time.

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 outputs msg.start, msg.end and msg.now which are todays start and end times, with offsets applied, in ISO format, and the current ISO time.

msg.sun is an object containing the azimuth and altitude, in degrees, of the current sun position. msg.moon is an object containing its position, phase, illumination and icon.