Registry / workflow / node-red-node-suncalc

node-red-node-suncalc

JSON →
library1.2.0jsnpmunverified

A Node-RED node that triggers signals at sunrise and sunset using the suncalc library. Current version 1.2.0. It calculates times based on a specified location and provides configurable definitions of sunrise/sunset with minute offsets. Outputs day/night status every minute and emits transitions. Also supplies sun/moon position data. Differentiators: integrated into Node-RED ecosystem, simple setup, two outputs for continuous state and edge triggers.

npm install node-red-node-suncalc
INSTALL
IMPORT
SIG · NODE-RED-NODE-SUNC
N
node-red-node-suncalc
workflowjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

node-red-node-suncalc
npm install node-red-node-suncalc
npm install node-red-node-suncalc --save
Install in your Node-RED user directory (~/.node-red). No import statement in JS; it's a Node-RED node.

Install the node via Node-RED palette manager, then drag into workspace, configure latitude/longitude, and connect to debug.

// No code example for Node-RED flow - install the palette node and configure in editor. // Typical flow: inject -> suncalc node -> debug // Sets lat/lon in node config. Outputs msg.payload 1 (day) or 0 (night).
Debug
Known issues
breakingIn version 1.0, msg.moon changed from a number to an object containing detailed moon data.
fix
Update flows that rely on msg.moon being a number to access properties like msg.moon.illumination or msg.moon.phase.
affects: >=1.0.0
gotchaThe node only outputs once per minute; state changes may be delayed up to 60 seconds.
fix
If you need sub-minute precision, consider using a different node or external cron.
affects: >=0.1.0
gotchaLatitude and longitude must be in decimal degrees; using degrees/minutes/seconds will produce incorrect times.
fix
Convert coordinates to decimal degrees (e.g., 40.7128, -74.0060).
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'suncalc'
Missing suncalc dependency; often because npm install was run in the wrong directory.
fix
Run 'npm install node-red-node-suncalc' from the Node-RED user directory (~/.node-red).
Node not found in palette after install
Node-RED not restarted or palette not refreshed.
fix
Restart Node-RED or use the Manage Palette option to refresh.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
node-redrequiredRuntime dependency; Node-RED is required to host the node.
suncalcrequiredCore library for calculating sun and moon times/positions.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
2
Resources
node-red-node-suncalc — npm install node-red-node-suncalc · libregistry