Astronomical Data API



i stumbled upon this page and found it interesting and would like to use the piston.

i was able to import without issue.

my problem is manually creating the global variables, say for @astronomical_twilight_begin for example. When i create the variable name “@astronomical_twilight_begin”, which I set with the ‘date & time’ data type. I am not sure what the value should be? Is it an expression? If so, is that the one defined on line 48 in the piston? Or is the value a date and time I manually set?


edit: issue resolved by leaving the value blank once the date and time variable has been created with a name for the variable itself.


Sorry for the delay, I was AFK for a few days.

Glad you got it sorted. Yes, just create the variable as “Date and Time” and set the value to “Nothing selected.”


Hello, I am seeing a problem with this piston after updating Webcore recently.

When the piston is executed I a seeing a ‘status 500’ error:

Anyone else experience this problem? And what the fix is? It’s actually impacting my routines that are location based and on time of day.

Here’s what the piston looks like:



This is external to WebCoRE and the piston. It looks like the SSL certificate at sunrise-sunset has expired:

This has happened once in the past that I can remember. I’ll bet your noticing was just coincident with the WebCoRE update since it happened less than a week ago.

There’s a simple fix. Just change the API string from HTTPS to HTTP:



There’s really no need for SSL, it’s just a best practice. Moving back to HTTP will make the piston work again and bypass the need for a valid SSL cert.


Thank you for your response.

I will give it a try.



Hello, has there been an update to the API? Earlier this morning the piston did not complete and there is an error logged in webCore. See screenshots below. At first glance, it doesnt appear to be related to the certificate error you looked into back in July.

Thank you


No, no change to the API nor is it the certificate error again. The error code is right there in the log. It’s a simple timeout error. Nothing really to do apart from waiting for it to run again tomorrow.

I checked my log from this morning and my instance ran fine. Something between your hub and their server just timed out. It’s really rare but I’ve had it happen a couple of times over the past couple of years.

I do have an error check in there so the global variables will retain yesteday’s values if there is an error. This way everything still works but we lose some of the hyper-precision of what this API provides over the internal sunrise/sunset calculations. You probably wouldn’t even notice for a day or two. :slight_smile:

If you wanted to, you could create a loop that would give it a second try before failing and/or send a notification if the status returned wasn’t 200 (OK).


appreciate the response.


I may just implement a loop to retry in case of initial failure.