Question about exec switch item with two commands

I used openhab 1.x for over a year and now move to a clean openhab2 installation.
I read about the new concepts and followed the discussion in this forum for a long time.

Now this is my first post in this forum with a probably really stupid question, but I just don’t get it:

How do I define a switch item with one command for switching on and another command for switching off?

I have two exec things defined:

Thing exec:command:vitrine_an [command="/opt/rc-switch/rcswitch-pi/ 3", interval=0, timeout=5]

Thing exec:command:vitrine_aus [command="/opt/rc-switch/rcswitch-pi/ 3", interval=0, timeout=5]

and a switch item:

Switch vitrine { channel="exec:command:vitrine_an:run"}

which powers on my lamp on switch on but of course does nothing on switch off, so I tried

Switch vitrine { channel=">[ON:exec:command:vitrine_an:run]>[OFF:exec:command:vitrine_aus:run]"}

without success.

It would be awesome if someone could point me in the right direction.
Thanks in advance!

1 Like

Referring to that post I changed my config to:

Thing exec:command:vitrine [command="/opt/rc-switch/rcswitch-pi/switch%2$ 3", autorun=true, timeout=5]
Item String vitrine { channel="exec:command:vitrine:input"}
Sitemap Switch item=vitrine label="Vitrine" mappings=[On="An", Off="Aus"]

But I get the following error in openhab2.log:

[ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘vitrine’ for widget org.eclipse.smarthome.model.sitemap.Switch
[] - Received HTTP POST request at ‘items/vitrine’ for the unknown item ‘vitrine’.

Any help would be much appreciated!

May be if you remove ‘String’ from ‘Item String vitrine…’

I tried that, too. Unfortunately withoug success. I now went back to exec binding 1.9

Hi Setfanie,

I know you state you went back to exec binding 1.9 but by any chance have you found a fix for this since?


Hi Nathan,

No unfortunately not. Still using exec 1.9

Am 22.04.2017 9:13 vorm. schrieb “Nathan Wilcox” <