Thing definitions and %2

Got a quick question, and hopefully I don’t seem like too much of a newbie.

From one of the posts I saw, there was a “Timestamp [%1$tm/%1$td %1$tH:%1$tM]” which I get. The value itself is %1, the $t means to treat it as a date time, and the m, d, H, and M are the format specifiers, as per the java page. I believe you suggested going out to JS, which is cool.

When enabling scripts to be run, “%2$s” is often added. as in “exec … switch%2$”.

I get the $s… treat it as a string. but why is it parameter 2?

When I replace the %2$s with a %s in my exec things, it still works fine.


From the exec binding’s docs:

command itself can be enhanced using the well known syntax of the java.util.Formatter class. The following parameters are automatically added:

the current date (as java.util.Date, example: %1$tY-%1$tm-%1$td)
the current State of the input channel (see below, example: %2$s)

To my knowledge the exec binding is the only one that uses a %2. Also, keep in mind this is not defining the label for an Item, this is modifying the command that gets called by the binding.

Thanks Rich… I read that section about 2-3 times, and missed it each time.