Exec Binding - Run once

Hi,
I am new to EXEC bindings.
I have setup an exec binding to run a command on BlackBeanControl (py).
Thing exec:command:switchTV [command="python /opt/BroadLink/BlackBeanControl/BlackBeanControl.py -c SwitchTV" interval=0, timeout=10, autorun=false]
The issue with this thing is that as soon as I save the broadlink.things it’s executed each 60 seconds. How I can disable the interval time? (I want to configure it as a switch)

I already replied to your github comment but I believe you may be missing a comma and the definition should look as follows:

Thing exec:command:switchTV [command="python /opt/BroadLink/BlackBeanControl/BlackBeanControl.py -c SwitchTV", interval=0, timeout=10, autorun=false]

It seems fine now thanks!
One more thing! Any ideas why none of the following works? (Switch is grayed out). What I am missing here?
Switch tvSwitch "Switch TV" ["Switchable"] {exec=">[ON:python /opt/BroadLink/BlackBeanControl/BlackBeanControl.py -c SwitchTV] >[OFF:python /opt/BroadLink/BlackBeanControl/BlackBeanControl.py -c SwitchTV]"}

Switch tvSwitch "Switch TV" ["Switchable"] { channel="exec:command:switchTV:run"}

Why have you defined the same switch twice?

I tried both of them (not at the same time). But none of them work (switch is disabled).

First question is: which version of exec Binding did you install?
For exec2 binding, you would have to define a thing

Thing exec:command:switchTV [command="python /opt/BroadLink/BlackBeanControl/BlackBeanControl.py -c SwitchTV", interval=0, timeout=10, autorun=false]

Maybe you will have to expose the complete path to python, i.e. /usr/bin/python

The switch in .items then would be

Switch tvSwitch "Switch TV" {channel="exec:command:switchTV:run"}

but this would only send the command if switched to ON, not if switched to OFF (regarding to the documentation)

If using the exec1 binding, you would not define a thing at all but do the item definition as follows:

Switch tvSwitch "Switch TV" ["Switchable"] {exec=">[ON:python /opt/BroadLink/BlackBeanControl/BlackBeanControl.py -c SwitchTV] >[OFF:python /opt/BroadLink/BlackBeanControl/BlackBeanControl.py -c SwitchTV]"}

Maybe you will have to expose the complete path to python, i.e. /usr/bin/python and it’s possible, that you have to replace the spaces with @@, so it would be like

Switch tvSwitch "Switch TV" ["Switchable"] {exec=">[ON:/usr/bin/python@@/opt/BroadLink/BlackBeanControl/BlackBeanControl.py@@-c@@SwitchTV] >[OFF:/usr/bin/python@@/opt/BroadLink/BlackBeanControl/BlackBeanControl.py@@-c@@SwitchTV]"}

In fact, as I did not test the exec2 binding yet, it’s possible that you have to do the same for exec2, I don’t know…

whether you use exec1 or exec2, the sitemap would look like

Switch item=tvSwitch

For using HABPanel, I can’t help, as I did not test this feature yet.

Hi @Udo_Hartmann and thanks for your reply.
I configured them exactly how you described but the switch is grayed out. The weird thing here is that I tagged it as “Switchable” and it appears on Homekit app in iOS and I can toggle it. So probaly it has something to do with “Control” panel in PaperUI

In question of Paper UI Control panel, this feature is not meant for daily use, but for a quick test when configuring openHAB2. So, I would not rely on this panel in any way :wink: