When & where is the next rocket launch worldwide?


#335

As an option, what I did was to split the notifications out. It messes up the one piston approach but it is relatively clean. In the piston I just update 3 global variables:

Then this simple piston will update with any changes and do the notification:

The rest of the piston can be unchanged. Since it is now just a ‘set variable’ command, you could put it inside your every and update every time new API data is pulled. My situation is little different since I have already removed the ‘every’.


#336

That concept should still work in a single piston setup… although traditionally, I try to avoid using @globals for pistons I post publicly.

Perhaps I need to think on this one. I really want a single piston with no outside hoops to jump thru.


Edit:

This may be a good time to insert your experimental code in my final block…


#337

As a data point, it has been working flawlessly for me for quite a while on multiple pistons.

One side note on this, if you edit the piston before the minute you chose, you will end up skipping that hour. i.e., if you use “:20” and then edit 15 minutes past, it won’t run until 20 minutes past the next hour. Most of the time that is not an issue.


#338

Good to know!


That expands even farther.
If it is 1 minute past the hour, and I set it to 59 past, it won’t actually run for nearly two hours.

This is a known quirk with webCoRE.
(and why all of my “crucial” pistons are somewhat near the beginning of the hour)


#339

I made a few changes to my piston, @SergL

Let me examine my log over the next few hours, and if all looks good, I will update the top piston here.


#340

I have made a handful of improvements to my piston, and updated the top post here. (build 177)

I removed the bogus {nle}, and instead added a fake hourly timer, that simply forces an update to the real launch time. That snippet runs at the top of the hour, and will display pic in the log, so you know it has successfully updated the launch timer.


Life is good… No globals, and still in a single piston. :sunglasses:


#341

Imported, lets see how it goes! You are the best! Thank you very much.


#342

Thanks!

I really like this piston, and this has been a fun challenge compartmentalizing the piston, and working around the API limitations.


#343

Got the launch notification last night for the Long March 4B that went up, looks like its all back to working properly again, thanks!


#344

FYI, I found another way to deal with those pesky “null” values. Previously, we used length(value)>4 since, for some reason, the “null” value returned 4 for length. For future reference, I stumbled across this gem:

bool

Syntax
bool(dynamic value)

Returns
Returns the truth value of the input. Accepts anything as input and will return true if value is either a non-zero number, a non-empty string (with some exceptions, see below), a non-empty device list, a non-empty date/time/datetime

Turns out if you look at bool(value) for winOpen (or mission), it will always return true when the value is set and false when it contains “null”.


#345

Interesting…

A few questions, (since you already have the test environment set up)

You mentioned a lot of TRUEs, but only one FALSE.

  • What about (no value set)
  • What about a single space
  • What about quotes with nothing inside “”

Edit:

In my quick testing, the only FALSE I could pull up was for (no value set).
(the other two examples above both returned true)

I would like to know what other cases will false be returned.


#346

I haven’t tried all the other cases. I tested against the string “null” values the come back from the launch API and “all” always returned false and a value returned true. Let me do a little more testing. According to the documentation, though, I would expect a single space to return true since it has a value. It is only supposed to return false for empty strings. Let you know in a bit…


#347

Here is my quick testing results. pretty much works as I expected except for the undefined variable (which wouldn’t be used anyway). Strange that an undefined variable returns true but everything else seems to work as expected from he documentation.

7/27/2020, 11:41:25 AM +133ms
+98ms	║notSetString= and bool() is false
+118ms	║spaceString= and bool() is true
+137ms	║emptyStringValue= and bool() is false
+157ms	║emptyStringExpression= and bool() is false
+177ms	║textString=Random text and bool() is true
+193ms	║undefinedString=Variable 'undefinedString' not found and bool() is true
+212ms	║nullString= and bool() is false

EDIT: Updated piston and logs to include ‘null’ string.


#348

Good tests… It appears that bool() returns true if there are any characters or symbols in the variable, except for null, which returns false


#349

I only want to be alerted about the launches that occur in Florida. I added a variable ‘state’ with the following expression:

$response.result[x].pad.location.state

I then added a condition for that at the bottom. Is that the best way to achieve that?


#350

Probably yes. That query can potentially return Florida.


#351

I missed the launch earlier, but watching it now…

I think this is a great visual showing Mars flybys and surface vehicles over the years…


#352

I had to watch it on replay also. 4:50 AM was way too early for me :slight_smile: Agree they had a lot of great graphics and background information. It was quite impressive show and discussion.


#353

After examining my code, I’d like to add to my previous statement.

The only piston change I would probably make from OP, is to the alert block, to check
IF variable w[x] equals Florida
instead of pulling fresh data.

Note… The “w” represents where… Usually a country, but if the launch is in the US, then the state will be listed here.


Maybe the Expression:

contains(w[x],"Florida")


#354

Man, Perseverance is huge… Even when still in “compact-mode”.


Here it is in all it’s glory…

I bet this one was fun to program.