I am having a really hard time with the exec2 binding. I have 2.1.0 configured with the demo setting (option selected right at the start), then i added the exec binding with a basic command to run and print the arguments it gets.
All the links are setup between the Thing and Items (i set the “simple” option to create them automatically).
Then I set the Input to “a123b”, and the command to:
/…/scripts/openhab ‘%1$s’ '%2$s’
As you can see, the input channel is setup.
Everything works find if I remove the ‘%2$s’ from the command, but if I add it in I get this error:
2017-08-15 20:07:12.902 [ERROR] [hab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’
I have tried that as well. Single quotes, double quotes, no quotes, tried
escaping the % and the $ too. No dice. Somehow I think I need to set the
display format in the input string item.
The lastInput is null, so the else clause is hit, attempting to format the string with only 1 parameter value, but the format specifier contains 2 parameters.
I don’t use exec so can’t fully answer. But I know that lots and lots of people have it working. A search of the forum for “exec %2 shows dozens of examples”.
Are you defining the Things in a .things file or in PaperUI. I’ve only seen people use the .things file so maybe that is part of the problem. Try defining your Things like the examples in the readme docs and see if it will work that way.
Yep, I’m having the same problem. And @namraccr seems to be on the right track - when you use a “run” channel type, it’s referencing lastInput, which is only assigned by the “input” channel type.