Sending parameter from Item to Exec Thing

Hi, as mentioned in other topics, I’m working on linking OH2 with Fibaro HC2. My current approach is to make a program which takes commands as inputs, and sets or gets values from the HC2. This program is executed in OH2 using the Exec binding.

I tried to make one Exec Thing, and wanted to let the different items send the corresponding parameters to this. However, it does not work, and I am not sure whether it is even possible, or if I am on the wrong path.

String Livingroom_TvLight "28 [%s] " { channel="exec:command:cmdtest:input" }
Thing exec:command:cmdtest [command="/home/pi/cmdtest %2$s", autorun=true]

With this example, cmdtest is executed with the dimmer value as its only parameter. I would like it to be executed as cmdtest 28 .

Should I create one thing per Item instead?

In OH1 you could pass the item name to the command string formatter. Currently, you can’t do that in the OH2 Exec binding. However, there will be probably be signficant changes to the OH2 code so you should enter a feature request in the appropriate issue tracker (I assume in openhab2-addons) and maybe that can be implemented relatively soon. For now, AFAIK you’ll need to create a thing per item or use a rule with an exec action.

Thanks! I plan to generate the config anyways, so that’s fine.