{"id":27991,"library":"node-red-node-suncalc","title":"Node-RED node-suncalc","description":"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.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/node-red/node-red-nodes","tags":["javascript","node-red","suncalc"],"install":[{"cmd":"npm install node-red-node-suncalc","lang":"bash","label":"npm"},{"cmd":"yarn add node-red-node-suncalc","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-red-node-suncalc","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency; Node-RED is required to host the node.","package":"node-red","optional":false},{"reason":"Core library for calculating sun and moon times/positions.","package":"suncalc","optional":false}],"imports":[{"note":"Install in your Node-RED user directory (~/.node-red). No import statement in JS; it's a Node-RED node.","wrong":"npm install node-red-node-suncalc --save","symbol":"node-red-node-suncalc","correct":"npm install node-red-node-suncalc"}],"quickstart":{"code":"// No code example for Node-RED flow - install the palette node and configure in editor.\n// Typical flow: inject -> suncalc node -> debug\n// Sets lat/lon in node config. Outputs msg.payload 1 (day) or 0 (night).","lang":"javascript","description":"Install the node via Node-RED palette manager, then drag into workspace, configure latitude/longitude, and connect to debug."},"warnings":[{"fix":"Update flows that rely on msg.moon being a number to access properties like msg.moon.illumination or msg.moon.phase.","message":"In version 1.0, msg.moon changed from a number to an object containing detailed moon data.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"If you need sub-minute precision, consider using a different node or external cron.","message":"The node only outputs once per minute; state changes may be delayed up to 60 seconds.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Convert coordinates to decimal degrees (e.g., 40.7128, -74.0060).","message":"Latitude and longitude must be in decimal degrees; using degrees/minutes/seconds will produce incorrect times.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'npm install node-red-node-suncalc' from the Node-RED user directory (~/.node-red).","cause":"Missing suncalc dependency; often because npm install was run in the wrong directory.","error":"Error: Cannot find module 'suncalc'"},{"fix":"Restart Node-RED or use the Manage Palette option to refresh.","cause":"Node-RED not restarted or palette not refreshed.","error":"Node not found in palette after install"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}