1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/time/suncalc/README.md
2020-04-18 13:55:57 +01:00

1.3 KiB

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

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.

The msg.topic is set 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).