Link or transfer item.command with item.state

Hi dear community,

i want to transfer my old OpenHAB2 Sitemaps, Rules, Items etc. to the new and great OpenHAB3 UI -great work by the way - I really love it -

One part is the exec binding. Regarding the documentation and my current implementation i have a switch and rule for every script i want to execute - like mention in the docs…

To save some programming and items I want to write the scriptsname kind of parameter into a specific string item as state - lets say this item named “arg”

Rule: When arg.state changed or updated then run “bash (arg.state).sh” ← something like that.

Thats all working for one specific item with one specific scriptsname.

Two ways I tried leading me to the following problems:

  1. In OH3 with rules, buttons or widgets I can only send commands. I cant update/change states as parameter → I want “to state” as something link “IRRemote_Args.Command”


  1. I am not able to set up a rule like: when item receive any command than change item.state to command (“Command” is required and i dont want to set a specific command - I want to set “Command” to “Any”)

Can I link an items state to its command or can I set up a rule like my 1. problem

thank you for your help


UI buttons and widgets always send commands, and only commands.

Do either from any rule. Your screenshot shows a state update action.
But the GUI point and click action is limited to pre-configured constants.

Use a script rule action for more complex evaluations.

If you use a scripted action, then you might as well use executeCommandLine() (or equivalent) to run that directly, and not bother with exec binding.

openHAB has a feature called ‘autoupdate’ that automatically does that for each Item by default. If that’s not working for you, you might want to investigate why.

autoupdate can be disabled for individual Items, or it may be suppressed if the Item is linked to some bindings (or a broken channel).
The command does need to ‘fit’ the Item type, i.e. commanding “banana” to a Switch won’t work.

Hi rossko57,

because I am lazy I tried your last suggestion (autoupdate). I forced the item to autoupdate the state with each received command. It works instantly.

The command does need to ‘fit’ the Item type, i.e. commanding “banana” to a Switch won’t work.

The Item I am sending commands to is a String type → I can send my commands as parameters to execute something.

Thanks a lot for your hint!

Greatings Phil

I havent tried your other solutions yet.

Just for info - autoupdate is enabld by default - if you had to force it, there will be a reason, most likely to do with channels it is linked to, like an old broken link.