node-red-nodes/time/timeswitch
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
..
locales/en-US added i18n help files (#766) 2021-03-12 13:17:23 +00:00
LICENSE Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
README.md update parser and time nodes info style 2016-03-02 13:27:52 +00:00
package.json Update package.jsons for mono-repo (#851) 2021-11-02 15:22:30 +00:00
timeswitch.html added i18n help files (#766) 2021-03-12 13:17:23 +00:00
timeswitch.js timeswitch node: time zone support; do not mark as misconfigured when sunrise/sunset not used and lat/lon not given (#757) 2021-02-26 14:38:28 +00:00

README.md

node-red-node-timeswitch

A Node-RED node to provide a simple timeswitch node to schedule daily on/off events.

Install

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

    npm install node-red-node-timeswitch

Usage

Sets msg.payload to 1 during on times, and 0 during off times.

Also uses the suncalc module to allow use of dawn and dusk.

Dawn and dusk times can be offset both positively (+ve) for minutes after dawn or dusk, and negatively (-ve) for minutes before dawn or dusk..

The output emits a msg.payload of 1 or 0 every minute depending on whether the current time is during the selected on time or off time.

If you just need the transitions from 0->1 or 1->0 then follow this node with an RBE node.

You may also optionally specify a msg.topic if required.

Note: For a more complex version with more built-in options see Pete Scargill's node-red-contrib-bigtimer node.