Sure can. This will check everyday for the next launch in Florida and set that date and time as the piston state. From there it will take that date and time and trigger a notification at that time which will populate the variables and push out with all the available info. If you are home and have a speaker setup it will also speak that same push notification. If you are in FL the next one should be Wednesday I believe.
Rocket Launch Notifications via API
I finally got a bit of freetime to play around with this one.
(I hope it’s OK that I started with your piston, @SergL)
Here are some the modifications I made:
- I stored the URL in a
variable
so it’s easier for others to import - I created a customizable offset
variable
, so the final alert can come in a few min early - I captured Flight Data at both events.
(I did not want to wait until the last minute to get this info) - I added a few comments up top to help
- I tweaked all Piston States and Logs
- I added Piston States to all events now (so you’ll see more info in advance)
- I added more detailed logs at all events (even the long descriptions)
- Once there’s no more FL launches in the list, the old
variables
are flagged
(IE: {nextLaunch} will never point to a previous date)
Here is a sample log from two days in advance:
(my hours are hidden in the pics for my privacy)
… and a sample Piston State
:
I am tempted to add a second alert to fire off at the real event… but I figured most people will want a bit of warning before the launch, so they’ll have time to grab their beer binoculars, or tune into the webcast, etc…
Edit:
I just tweaked the spoken phrase so it sounds more natural to me… Sample output:
NASA Alert… Falcon 9 is launching in 30 minutes. Crew Dragon Demo-2 (DM-2), at Kennedy Space Center on pad LC-39A. For the first time since the last flight of the Space Shuttle in 2011 … etc
(she continues to read both sentences)
When & where is the next rocket launch worldwide?
Once again, you made something 1000% better!! I will be replacing mine with this one as it does everything I want and is WAY cleaner!!
Thank you!
edit, not sure if its because you worked off of a pervious one that was asking for a URL during import but that box still pops up even though you have it set as a variable.
edit #2, I am adding the nasa link as part of a text message option so that the user can click the link and follow on their device during launch, right out of the message.
Just FYI. Sorry, I had created a piston for this myself last week and then I forgot to post it. Of course, @WCmore outshines mine by far but I did add one additional feature which is the time to launch.
This is the piston state:
and this is the log:
5/24/2020, 11:13:59 PM +154ms
+0ms ╔Received event [Las Vegas].time = 1590387240000 with a delay of -846ms
+118ms ║Checking Florida Launches
+1125ms ║ Next launch is at 2020-05-27T20:33Z which is Wed, May 27 2020 @ 1:33:00 PM PDT
+1125ms ║ [in 2 days, 14 hours, 18 minutes, and 59 seconds].
+1153ms ║ Launch will be a Falcon 9 from pad LC-39A
+1154ms ║For the first time since the last flight of the Space Shuttle in 2011, U.S. astronauts will go to orbit from American soil. As part of NASA's Commercial Crew Program, SpaceX's Falcon 9 will launch the Crew Dragon spacecraft to the International Space Station.
+1180ms ║Setting up scheduled job for Mon, May 25 2020 @ 11:14:00 PM PDT (in 86399.666s)
+1189ms ╚Event processed successfully (1188ms)
For those interested in the next launch (regardless of the location), I have created a beefy piston over here.
Can you see anything obvious as to why this didn’t notify me last night?
6/3/2020, 12:34:59 AM +220ms
+0ms ╔Received event [Home].time = 1591158900000 with a delay of -781ms
+139ms ║RunTime Analysis CS > 29ms > PS > 60ms > PE > 51ms > CE
+143ms ║Runtime (65927 bytes) successfully initialized in 60ms (v0.3.110.20191009) (142ms)
+144ms ║╔Execution stage started
+155ms ║║Cancelling statement #1's schedules...
+162ms ║║Sending external web request to: fdo.rocketlaunch.live/json/launches/next/5
+1426ms ║║Executed virtual command httpRequest (1264ms)
+1433ms ║║Executed virtual command setVariable (4ms)
+1447ms ║║Comparison (dynamic) FL is (string) FL = true (1ms)
+1449ms ║║Condition #20 evaluated true (6ms)
+1450ms ║║Condition group #19 evaluated true (state did not change) (8ms)
+1453ms ║║Cancelling statement #21's schedules...
+1459ms ║║Executed virtual command setVariable (3ms)
+1467ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+1468ms ║║Condition #26 evaluated true (4ms)
+1469ms ║║Condition group #25 evaluated true (state did not change) (6ms)
+1472ms ║║Cancelling statement #69's schedules...
+1480ms ║║Executed virtual command setVariable (4ms)
+1488ms ║║Calculating (datetime) 1591144500704 - (datetime) 1591158900705 >> (datetime) -14400001
+1493ms ║║Calculating (decimal) -1.4400001E7 / (decimal) 3600000.0 >> (decimal) -4.000000277777778
+1509ms ║║Calculating (date) 1591156800000 + (time) 86280000 >> (datetime) 1591243080000
+1516ms ║║Executed virtual command setVariable (4ms)
+1523ms ║║Executed virtual command setVariable (4ms)
+1530ms ║║Executed virtual command setVariable (3ms)
+1538ms ║║Executed virtual command setVariable (3ms)
+1545ms ║║Executed virtual command setVariable (3ms)
+1552ms ║║Executed virtual command setVariable (4ms)
+1559ms ║║Executed virtual command setVariable (3ms)
+1566ms ║║Calculating (string) Next FL launch is at + (string) 2020-06-03T23:58Z >> (string) Next FL launch is at 2020-06-03T23:58Z
+1570ms ║║Calculating (string) Next FL launch is at 2020-06-03T23:58Z + (string) which is >> (string) Next FL launch is at 2020-06-03T23:58Z which is
+1573ms ║║Calculating (string) Next FL launch is at 2020-06-03T23:58Z which is + (string) Wed, Jun 3 2020 @ 7:58:00 PM EDT >> (string) Next FL launch is at 2020-06-03T23:58Z which is Wed, Jun 3 2020 @ 7:58:00 PM EDT
+1576ms ║║Next FL launch is at 2020-06-03T23:58Z which is Wed, Jun 3 2020 @ 7:58:00 PM EDT
+1578ms ║║Executed virtual command log (2ms)
+1592ms ║║Calculating (string) Falcon 9 + (string) is scheduled to launch the >> (string) Falcon 9 is scheduled to launch the
+1597ms ║║Calculating (string) Falcon 9 is scheduled to launch the + (string) [Starlink-8] >> (string) Falcon 9 is scheduled to launch the [Starlink-8]
+1601ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-8] + (string) at >> (string) Falcon 9 is scheduled to launch the [Starlink-8] at
+1605ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-8] at + (string) Cape Canaveral AFS >> (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS
+1609ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS + (string) from pad >> (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad
+1613ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad + (string) SLC-40 >> (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1616ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40 + (string)
+1617ms ║║ >> (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1620ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1620ms ║║ + (string) A SpaceX Falcon 9 rocket will launch the Starlink-8 mission on Wednesday, June 3, 2020 at 11:58 PM (UTC). >> (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1620ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-8 mission on Wednesday, June 3, 2020 at 11:58 PM (UTC).
+1623ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1623ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-8 mission on Wednesday, June 3, 2020 at 11:58 PM (UTC). + (string)
+1623ms ║║ >> (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1623ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-8 mission on Wednesday, June 3, 2020 at 11:58 PM (UTC).
+1626ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1626ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-8 mission on Wednesday, June 3, 2020 at 11:58 PM (UTC).
+1626ms ║║ + (string) null >> (string) Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1626ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-8 mission on Wednesday, June 3, 2020 at 11:58 PM (UTC).
+1626ms ║║null
+1630ms ║║Falcon 9 is scheduled to launch the [Starlink-8] at Cape Canaveral AFS from pad SLC-40
+1630ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-8 mission on Wednesday, June 3, 2020 at 11:58 PM (UTC).
+1630ms ║║null
+1631ms ║║Executed virtual command log (2ms)
+1644ms ║║Calculating (string) 🚀 + (string) Falcon 9 >> (string) 🚀 Falcon 9
+1649ms ║║Calculating (string) 🚀 Falcon 9 + (string) is scheduled to launch from >> (string) 🚀 Falcon 9 is scheduled to launch from
+1653ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from + (string) Falcon 9 is scheduled to launch from [Starlink-8]
+1657ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from >> (string) 🚀 Falcon 9 is scheduled to launch from
+1661ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from + (string) Cape Canaveral AFS >> (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS
+1665ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS + (string) on >> (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on
+1669ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on + (string) Wed, Jun 3 2020 @ 7:58:00 PM EDT >> (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on Wed, Jun 3 2020 @ 7:58:00 PM EDT
+1672ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on Wed, Jun 3 2020 @ 7:58:00 PM EDT + (string) from pad >> (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on Wed, Jun 3 2020 @ 7:58:00 PM EDT from pad
+1675ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on Wed, Jun 3 2020 @ 7:58:00 PM EDT from pad + (string) SLC-40 >> (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on Wed, Jun 3 2020 @ 7:58:00 PM EDT from pad SLC-40
+1678ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on Wed, Jun 3 2020 @ 7:58:00 PM EDT from pad SLC-40 + (string) . >> (string) 🚀 Falcon 9 is scheduled to launch from Cape Canaveral AFS on Wed, Jun 3 2020 @ 7:58:00 PM EDT from pad SLC-40.
+1681ms ║║Executed virtual command setState (0ms)
+1683ms ║╚Execution stage complete. (1540ms)
+1708ms ║Setting up scheduled job for Thu, Jun 4 2020 @ 12:35:00 AM EDT (in 86399.072s)
+1717ms ╚Event processed successfully (1717ms)
That piston is scheduled to run once daily, (with no notifications) …
The alert should happen 30 min prior to {nextLaunch}…
Did that variable
get set properly?
The next thing in the log is the check on the next day. Shouldn’t there have been a scheduled job -30 minutes from the launch in the log that I posted?
Not sure, I’ll keep an eye out next time. Right now it shows next launch as 6/5. Should that be correct?
The next Florida launch date is currently targeted for June 12, 2020 (UTC). (no time given yet)
Here is a direct link to the API, for reference.
And it now has that correct date. But back on 6/6, it showed the next launch as 6/5. I guess I’ll just see what happens on the 12th.
I forgot to reply to this, but it didn’t work for the launch on the 12th. I know that you have your other huge rocket piston, but are you still using this one at all?
Every time I’ve noticed, nextLaunch is set, but it fails to notify me.
Can you post your current piston please?
There are a handful of examples in this thread, and I’d like to see what you are working with.
Unfortunately, I am not. I quickly shifted over to a dedicated thread, where I’ve made a lot of improvements to the piston. (although I did remove the Florida section… That piston keeps track of all locations)
Thanks for the image…
What happens when “IF Time & Date happens daily at X” triggers
? (line 89)
Without seeing a log, I would guess that maybe the GET request was sent, but the 20 sec wakeup afterwards cancelled the rest of the code?
Here’s the log that ran this morning, for the launch today. NextLaunch appears to be set correctly. For whatever reason, I don’t think the Date & Time trigger is working. Everything else seems okay.
6/26/2020, 12:34:59 AM +65ms
+1ms ╔Received event [Home].time = 1593146100000 with a delay of -935ms
+105ms ║RunTime Analysis CS > 22ms > PS > 39ms > PE > 44ms > CE
+108ms ║Runtime (66011 bytes) successfully initialized in 39ms (v0.3.110.20191009) (106ms)
+109ms ║╔Execution stage started
+119ms ║║Cancelling statement #1's schedules...
+126ms ║║Sending external web request to: fdo.rocketlaunch.live/json/launches/next/5
+902ms ║║Executed virtual command httpRequest (775ms)
+906ms ║║Executed virtual command setVariable (2ms)
+918ms ║║Comparison (dynamic) FL is (string) FL = true (1ms)
+920ms ║║Condition #20 evaluated true (6ms)
+921ms ║║Condition group #19 evaluated true (state did not change) (7ms)
+923ms ║║Cancelling statement #21's schedules...
+928ms ║║Executed virtual command setVariable (3ms)
+935ms ║║Comparison (boolean) true is (boolean) true = true (1ms)
+937ms ║║Condition #26 evaluated true (5ms)
+938ms ║║Condition group #25 evaluated true (state did not change) (6ms)
+940ms ║║Cancelling statement #69's schedules...
+945ms ║║Executed virtual command setVariable (2ms)
+953ms ║║Calculating (datetime) 1593131700014 - (datetime) 1593146100016 >> (datetime) -14400002
+957ms ║║Calculating (decimal) -1.4400002E7 / (decimal) 3600000.0 >> (decimal) -4.000000555555555
+974ms ║║Calculating (date) 1593144000000 + (time) 72780000 >> (datetime) 1593216780000
+979ms ║║Executed virtual command setVariable (2ms)
+985ms ║║Executed virtual command setVariable (2ms)
+991ms ║║Executed virtual command setVariable (3ms)
+996ms ║║Executed virtual command setVariable (2ms)
+1002ms ║║Executed virtual command setVariable (2ms)
+1008ms ║║Executed virtual command setVariable (2ms)
+1014ms ║║Executed virtual command setVariable (3ms)
+1021ms ║║Calculating (string) Next FL launch is at + (string) 2020-06-26T20:13Z >> (string) Next FL launch is at 2020-06-26T20:13Z
+1024ms ║║Calculating (string) Next FL launch is at 2020-06-26T20:13Z + (string) which is >> (string) Next FL launch is at 2020-06-26T20:13Z which is
+1027ms ║║Calculating (string) Next FL launch is at 2020-06-26T20:13Z which is + (string) Fri, Jun 26 2020 @ 4:13:00 PM EDT >> (string) Next FL launch is at 2020-06-26T20:13Z which is Fri, Jun 26 2020 @ 4:13:00 PM EDT
+1030ms ║║Next FL launch is at 2020-06-26T20:13Z which is Fri, Jun 26 2020 @ 4:13:00 PM EDT
+1031ms ║║Executed virtual command log (1ms)
+1054ms ║║Calculating (string) Falcon 9 + (string) is scheduled to launch the >> (string) Falcon 9 is scheduled to launch the
+1059ms ║║Calculating (string) Falcon 9 is scheduled to launch the + (string) [Starlink-10 (57x), BlackSky Global 5 & 6] >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6]
+1063ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] + (string) at >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at
+1068ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at + (string) Kennedy Space Center >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center
+1072ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center + (string) from pad >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad
+1076ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad + (string) LC-39A >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1079ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A + (string)
+1079ms ║║ >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1082ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1082ms ║║ + (string) A SpaceX Falcon 9 rocket will launch the Starlink-10 (57x) mission on Friday, June 26, 2020 at 8:18 PM (UTC). >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1083ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-10 (57x) mission on Friday, June 26, 2020 at 8:18 PM (UTC).
+1085ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1086ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-10 (57x) mission on Friday, June 26, 2020 at 8:18 PM (UTC). + (string)
+1086ms ║║ >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1086ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-10 (57x) mission on Friday, June 26, 2020 at 8:18 PM (UTC).
+1088ms ║║Calculating (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1088ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-10 (57x) mission on Friday, June 26, 2020 at 8:18 PM (UTC).
+1089ms ║║ + (string) null >> (string) Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1089ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-10 (57x) mission on Friday, June 26, 2020 at 8:18 PM (UTC).
+1089ms ║║null
+1092ms ║║Falcon 9 is scheduled to launch the [Starlink-10 (57x), BlackSky Global 5 & 6] at Kennedy Space Center from pad LC-39A
+1092ms ║║A SpaceX Falcon 9 rocket will launch the Starlink-10 (57x) mission on Friday, June 26, 2020 at 8:18 PM (UTC).
+1092ms ║║null
+1093ms ║║Executed virtual command log (1ms)
+1106ms ║║Calculating (string) 🚀 + (string) Falcon 9 >> (string) 🚀 Falcon 9
+1110ms ║║Calculating (string) 🚀 Falcon 9 + (string) is scheduled to launch from >> (string) 🚀 Falcon 9 is scheduled to launch from
+1114ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from + (string) Falcon 9 is scheduled to launch from [Starlink-10 (57x), BlackSky Global 5 & 6]
+1119ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from >> (string) 🚀 Falcon 9 is scheduled to launch from
+1123ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from + (string) Kennedy Space Center >> (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center
+1126ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center + (string) on >> (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on
+1130ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on + (string) Fri, Jun 26 2020 @ 4:13:00 PM EDT >> (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on Fri, Jun 26 2020 @ 4:13:00 PM EDT
+1133ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on Fri, Jun 26 2020 @ 4:13:00 PM EDT + (string) from pad >> (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on Fri, Jun 26 2020 @ 4:13:00 PM EDT from pad
+1136ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on Fri, Jun 26 2020 @ 4:13:00 PM EDT from pad + (string) LC-39A >> (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on Fri, Jun 26 2020 @ 4:13:00 PM EDT from pad LC-39A
+1138ms ║║Calculating (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on Fri, Jun 26 2020 @ 4:13:00 PM EDT from pad LC-39A + (string) . >> (string) 🚀 Falcon 9 is scheduled to launch from Kennedy Space Center on Fri, Jun 26 2020 @ 4:13:00 PM EDT from pad LC-39A.
+1141ms ║║Executed virtual command setState (0ms)
+1144ms ║╚Execution stage complete. (1034ms)
+1145ms ║Setting up scheduled job for Sat, Jun 27 2020 @ 12:35:00 AM EDT (in 86399.791s)
+1152ms ╚Event processed successfully (1152ms)