Cant get exec binding to work with parameter (created throught the ui)

Hi,
I have search but not find any solution for my problem.
I use openhab 3
I have included the exec binding and try to get a command to run with a parameter.

I configure all throught the UI.

I have craeted a Thing with exec binding
the commad is ‘program %2$s’
I have added the program in the whitelist file.

then I add chanals for the input and run.

I then craete a rule where i send a command with the argument to the imput item.
next in the rule is to sendcommand ON to the run item.

When I run the rule att got a error in the log
'program %2$s ’ is not whitelisted

What is i doing wrong?
why will not %2$s be replaced with the data that is satt to input item?

Hope somone can help me, I almost give up.
Sincerely
Mats

We’ll need to see the Thing that you created, and its channels.

Use the code tab in your screen view and paste that text here.

‘program %2$s’ != 'program %2$s ’ - mind the space. :thinking:

1 Like

Thanks for the replay

here is the thing file
UID: exec:command:ed776c85ec
label: MyCommand
thingTypeUID: exec:command
configuration:
transform: REGEX((.*))
interval: 0
autorun: false
command: /home/openhabian/nexa/nexa_evening_light.sh
timeout: 15

Sorry but I do not fins any place to get code for channels…

but here is the rule code
configuration: {}
triggers: []
conditions: []
actions:

  • inputs: {}
    id: “1”
    configuration:
    itemName: MyCommand_Input
    command: 1 1
    type: core.ItemCommandAction
  • inputs: {}
    id: “2”
    configuration:
    itemName: MyCommand_Running
    command: ON
    type: core.ItemCommandAction

thanks for the help

No sign of that here

sorry it was a copy paste error, have try several thing during all testes

thing look like this
UID: exec:command:ed776c85ec
label: MyCommand
thingTypeUID: exec:command
configuration:
transform: REGEX((.*))
interval: 0
autorun: false
command: /home/openhabian/nexa/nexa_remote %2$s
timeout: 15

Hope it will helt you to see what i am doing wrong

It is ON now but I also set it to OFF before run rule

Alright, if you have finished changing things, what is left in your openhab.log now?
Did you understand @Ap15e post above, about the extra space on the end?

now the only log I got is this
2022-11-25 21:53:48.132 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute ‘/home/openhabian/nexa/nexa_remote %2$s’, but it is not contained in whitelist.

And I understand the comment about the extra whitespace and I have removed all extra space.

Please post your exec.whitelist and its location in the filesystem.

Thanks again for helping me.

the location of whitelist file is
/etc/openhab/misc/exec.whitelist

the content is

For security reasons all commands that are used by the exec binding or transformation need to be whitelisted.

Every command needs to be listed on a separate line below.

/home/openhabian/nexa/nexa_remote 1 1
/home/openhabian/nexa/nexa_remote 1 0

Now it works,
I started all over agian an created thing and items again, then a added folowing line in whitelist
/home/openhabian/nexa/nexa_remote %2$s

thansk for the help