EXEC Binding HABmin

hey guys,

i want to control a 433MHz power socket via a shell script. It needs to be executed if I press the switch in Openhab2. I tried to install the Thing and Item via HABmin. But I don’t understand how I can control the ON and OFF command with the new Binding.

The 1.9 Binding does it via “On=/opt/onscript”>“Off=/opt/offscript”.

Thank you!

Hi, sorry I can’t help you, I have similar issue. The new “thing” version of exec is not clear to me also. Documentation is far from perfection or rather there are not many examples.

There is now an input channel (of type String) that will provide a command line parameter to the program/script that is executed. When the state of this channel changes, the program/script is executed.

So, I suggest you do the following:

  • merge your two scripts (onscript and offscript) to one script with one command line parameter (“on” or “off”) to control the action to take.
  • create an item (of type String) associated with the Input channel.
  • write a rule that triggers on a change of state of your switch (on the sitemap), and sets the state of the String item to “ON” or “OFF” respectively.

Ps! Don’t forget to use “interval=0” in your thing file, to avoid having your script “running rogue”, :slight_smile:

Hey Kjetil,

ok, thats not really neat but if thats the way how to do it now in OH2 thats the way how to do it.

Thank you!