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:
- The API lists the next 5 launches, but this piston focuses mostly on the next one scheduled
- Once that launch passes, it will focus on the next one
- If the launch is farther away than 1 week, it draws a basic tile (square)
- If the launch is within 1 week, it draws a detailed gauge (circle)
- If the exact time for launch is listed, the background will be blue
- If an estimated time for launch is listed, the background will be purple
- Some dates don’t have a time yet, so it will temporarily use an early time for the math
- Some events do not have a date yet, so there will be an error (obviously)
- As the launch approaches, fresh pulls from the API will confirm the times are still accurate
- Shortly before the launch, you will hear a voice alert (if your voice is setup)
- Shortly before the launch, you will get a SMS (sample below)
- 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:
(I would avoid showing “Details” since a ton of data is displayed)
Then, just let it run for a day.
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)
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)