When & where is the next rocket launch worldwide?


#1

First, I want to thank @dwood1234 for sharing this API link.
My goals are very different than his, so I created this (mostly) from scratch.


Since this thread revolves around space travel, perhaps we need music to match…

Strap in, and light 'em up… This instrumental can really take you places…

Drums (flowing into) Space… w/special guests Branford Marsalis on sax.

Prepare for lift-off…


I am a huge astronomy buff, and this idea has been on my To-Do list for quite some time…
I am happy to finally be able to share this with you all.

Essentially, this piston pulls data from an API once twice a day, and does a whole lot of calculations to determine the next Rocket that is scheduled to launch around the world. It then updates the Dashboard display hourly.

A few notes before we dive in:

  1. The API lists the next 5 launches, but this piston focuses mostly on the next one scheduled
  2. Once that launch passes, it will focus on the next one
  3. If the launch is farther away than 1 week, it draws a basic tile (square)
    pic
  4. If the launch is within 1 week, it draws a detailed gauge (circle)
    pic
  5. If the exact time for launch is listed, the background will be blue
  6. If an estimated time for launch is listed, the background will be purple
  7. Some dates don’t have a time yet, so it will temporarily use an early time for the math
  8. Some events do not have a date yet, so there will be an error (obviously)
  9. As the launch approaches, fresh pulls from the API will confirm the times are still accurate
  10. Shortly before the launch, you will hear a voice alert (if your voice is setup)
  11. Shortly before the launch, you will get a SMS (sample below)
    pic
  12. Hovering the mouse over an icon displays a lot more info.
    (Samples below, although normally, only one tile is seen at a time)

    (the left image is my latest update, showing tags because there is no mission posted)

It’s worth mentioning that at least one of the locations has a lot of characters…
(IE: “RocketLab Launch Complex, Mahia Peninsula” in the 3rd pic)
The piston below now limits this line to a 20 char maximum, so it remains legible in the tile.
(although the hover text will still show the full name)


This piston works well right out of the box, but you can tweak the first 2 variables

  • {hourToRequest} = Choose a number between 1 and 12, and those will be the hours that fresh data is pulled… I’d recommend using something between 1-5 so you get fresh data early each day. (it’s currently set to update in the 1am & 1pm hours, but will be more frequent near a launch)
  • {minOffsetBeforeAlert} = Choose a negative number that denotes how much warning you want (in minutes) before the launch window begins (currently set at -30)

Without further ado… here is what you came here for…
Import Code: “uakk(build 177 last updated July 23rd)

I recommend importing it, and double checking the first two variables to make sure they are right for you… (Bonus points if you edited line 63 to point to a different minute. We don’t want a hundred pistons all pulling data at 6 minutes past the hour)

Once the piston is running, store it in one of the following categories:
pic
(I would avoid showing “Details” since a ton of data is displayed)

Then, just let it run for a day.


:warning: Please note that I coded this specifically with the intent of keeping the web requests to a minimum, so this piston has to run for a little while before it will look like it is working. (depending on the time, the first execution should happen within 67 minutes)


Future Goals:

There are a few bonus dataPoints in this piston that still have more potential. (IE: Tags)
I took the time to code these because I see a future use for them.
IE: IF {tags} contains “ISS” then do something…

Note: Tags are written to the logs twice a day, but they also serve another purpose… When there is no mission listed in the API, the hover text will display the {tags} to help paint a better picture.


Note:

When importing this, it prompts for a URL. Just leave it blank.
(it is stored in a variable internally)


alert

It is now disabled by default, but if you would like a voice alert before the event, you can enable the final block of code. (not seen in the image above)

This should (hopefully) keep the WAF high…

If you decide to enable the voice alert, keep in mind that every house is different, so I did not place any restriction on the Voice alert at T-30 minutes.

In other words, if you enable Alexa, you may want to add one extra line of code in the last IF to prevent her from waking you up on an early morning launch. (IE: My voice alerts only speak if I am awake)


Rocket Launch (Dual Piston fork)
Weather alert if it rains in my region
Replace piston with new one from backup code
Rocket Launch Notifications via API
Rocket Launch Notifications via API
Rocket Launch Notifications via API
#2

For anyone curious, we can better understand the API by taking a look at the API Documentation.
(it lists descriptions for all of the dataPoints)

For a textual overview, here is a nice html list of all the scheduled launches.
(showing all the way up thru 2024)


#3

Awesome, as usual! I am installing this tonight. Thanks!

EDIT: One note. For tzOffset, the formula ($localNow-$utc)/3600000 works generically for any timezone so never needs editing.


#4

Sweet… Just be aware that this piston is a bit strange because when it first runs, it will appear to be broken… but it’s not.

I just have blocks in place to keep the API requests to a minimum.

IE: It updates the data once a day in the early morning, but it will update the Dashboard hourly.


Edit:

I have improved the piston above, so now (even with a new piston), it will pull fresh data on the first natural execution.


#5

Thanks for this… I have added it to this piston, and a fresh green snapshot has been uploaded.


#6

FYI, I had been wanting to do this experiment for a while and just did. You can actually change the number at the end of the URL and get however many future launches you want (I tested up to 10). Pretty cool.


#7

Yes, I noticed that too, but most of the later launches are so vague at this point.
Many only list the month & day… Some only list the tentative month…
(which is why a purple background represents an estimate)

Hopefully, by the time they reach the front of the line [0], and this piston logs it, the precise times should be posted… (a blue background will confirm this)


#8

Agreed. It was just a curiosity. Although, if only interested in the next launch, you could just use ‘1’, or in the case of your ‘x’ variable ‘x+1’ and you would get all the information you need and no more. Not that it matters as I dont think the amount of data requested impacts the speed or anything else.


#9

My original goal was to gather data for the next two launches… but my piston grew in size to a point where I can barely add anything else to it. (it’s currently at 17 18 chunks)

So instead of gathering partial data for two events, I decided to focus on all data for a singular event.


By the way, I updated the piston above with your timezone suggestion. :+1:


#10

Side question: When I select one of the options that does not show details, How do I go in to edit the piston again in the future? Is there an easier way than changing the category to show details and then changing back when I’m done? thanks.


#11

Great question!

Ctrl-Click on the tile image will take you to the “Edit” page for that piston.


Edit:

I guess this is the advice I should have given to @stav242 in the other thread.


#12

This has been bugging me for a while and I have mostly left the details visible just for ease of editing. This really helps. FYI, for Mac, the Ctrl-Click only worked on the large tiles, but not the regular tiles. Shift-Click worked in all cases.


#13

That is good to know, Thanks.


If you really want to keep the details visible, you can reduce the text down to 2 or 3 lines if you edit the “Piston State” line, and remove the “\n” that are scattered about:


IE: Change this:

pic

… to something like:

(don’t delete any spaces you find though)

Doing this will condense your Detailed view at least 9 lines…


#14

I’m happy that you took a crack at this. I started with redoing a global version of the FL based piston but you are lightyears ahead so just going to use yours! Haven’t really played with Tiles yet so that will be fun as well!


#15

FYI, I thought it would be nice for the gauge to give more detail as the launch got close so I added a nested if for hrsToLaunch<10:

[chart-gauge min=10 max=0 greenFrom=10 greenTo=6 greenColor=#FFD6C2 yellowFrom=6 yellowTo=2 yellowColor=#FAFFC2 redFrom=2 redTo=0 redColor=#C2FFD1 minorTicks=2 majorTicks=.9876543210|{vehicle}]

Looks like this:

02%20AM

I also added the local launch time (nextLaunch) to the Launch details when I hover over the gauge because I can’t think in UTC :slight_smile:


#16

As soon as my head hit the pillow, I realized that after all my fancy coding, I forgot to code the basic time output (for us mere humans). I will wait a few hours until after this launch (to test the timer) and then post a fresh green snapshot here…


#17

I couldn’t wait… LOL

I’ve updated the original post to display the simple time converted to our time zone…
(I also did about a dozen minor tweaks)

Here is a sample output, with my local hour blurred out for privacy.


#18

updating now!!


#19

*sighs*

I just tested the spoken alert, and apparently, when Alexa sees the abbreviation “Wed”, she pronounces it like “wed”. (IE: Susie and I were wed in the park)

I have tweaked the code above so now she will say the full name (IE: Wednesday) instead of trying to abbreviate.

My apologies for all the updates.
(I realize that my code takes a bit of time to calibrate itself afterwards)


#20

T-60 minutes to launch…
(the window is precise here, with only one shot to launch)

There is a live feed here.


Edit:

Wow, that cockpit looks so simplistic… There’s hardly any buttons or panels visible!

Compared to the Space Shuttle Discovery: