Node for datetime of next full moon and next new moon

I find many nodes for calculating the current moon phase, but none that gives me the date and time of the next full moon / new moon at a given geo location.

I know nothing about astronomy (but I do like Space & the film interstellar :grinning:)

This type of data, is usually harvested from API's.

A quick search yields

it shouldn't be too difficult to create a set of nodes to grab the data using the HTTP Request Node.

not sure if these are paid access services

2 Likes

Maybe raise a request against this node to see if redmatic would be interested in adding that.

rdmtc/node-red-contrib-sun-position: This is a ultimate Node-Red Timer, Sun, Moon and Blind flow control. (github.com)

1 Like

Thanks!
Meteomatics would require a payed subscription. So I will use the following API which is free and also provides the required data: https://aa.usno.navy.mil/data/MoonPhases

Here is a solution, using the free API that I mentioned above:

image

[{"id":"b65bc852501c5f8b","type":"function","z":"4c71f9ee.cbd868","name":"Prep request:  GET Data","func":"// API explanation:\n// https://aa.usno.navy.mil/data/api#phase\n// Example:\n// https://aa.usno.navy.mil/api/moon/phases/date?date=2009-5-3&nump=48\n\nlet queryDate = msg.date_reverse_dashed; //i.e. \"2023-04-28\"\nlet queryPhaseCnt = 4;\n\nmsg.url = `https://aa.usno.navy.mil/api/moon/phases/date?date=${queryDate}&nump=${queryPhaseCnt}`;\nmsg.method= \"GET\";\n//msg.headers = \"\";\n//msg.cookies= \"\";\n//msg.payload = JSON.stringify(PAYLOAD)\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":540,"wires":[["c47e893aeb2067ba"]]},{"id":"7f47d0f3f5beb406","type":"switch","z":"4c71f9ee.cbd868","name":"HTTP 200 ?","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":540,"wires":[["6b53804451d09627"],["1926d588ad59e459"]]},{"id":"c47e893aeb2067ba","type":"http request","z":"4c71f9ee.cbd868","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"7b79ba19.4d8194","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"credentials":{},"x":550,"y":540,"wires":[["7f47d0f3f5beb406"]]},{"id":"7b79ba19.4d8194","type":"tls-config","name":"Ignore Invalid Cert","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.