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

33 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

node-red-node-suncalc
=====================
A <a href="http://nodered.org" target="_new">Node-RED</a> node to provide a signal at sunrise and sunset.
Install
-------
2020-04-18 14:55:57 +02:00
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
<i><a href = "https://github.com/mourner/suncalc" target="_new">suncalc</a></i> module for details.
2020-04-18 14:55:57 +02:00
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 <i>1</i> or <i>0</i> every minute
depending if day-time (1) or night-time (0).
The second output emits only on the transition between night to day (<i>-> 1</i>) or day to night (<i>-> 0</i>).
2020-04-18 14:55:57 +02:00
It also outputs <code>msg.start</code>, <code>msg.end</code> and <code>msg.now</code> 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.