Wireless sockets in openhab

Hey,

i want to turn on/off my wireless sockets via openhab on my RaspberryPi.
I can already turn them on/off with the Pi but my configuration with openhab does not work. I tried it first with the exec binding but now it want to do it with a rule. Does anyone know why it does not work?

default.items:
Switch TV_Steckdose “Fernseher”

mysite.sitemap:
sitemap mysite label=“Smarthome” {
Frame label=“Steckdosen” {
Switch item=TV_Steckdose label=“Lautsprecher” mappings=[ON=“An”, OFF=“Aus”]
}
}
default.rules
rule "TV_Steckdose Switch On"
when
Item TV_Steckdose changed to ON
then
sendCommand(bash /scripts/TV_AN.sh)
end

rule "TV_Steckdose Switch Off"
when
Item TV_Steckdose changed to OFF
then
sendCommand(bash /scripts/TV_AUS.sh)
end

to execute a bash script from within a rule, read:

&
http://docs.openhab.org/addons/bindings/exec1/readme.html

hmm i dont use the exec binding

hmmm then you can’t execute bash scripts from within a rule without it :slight_smile:

and if i write the command instead of the script?

“sendCommand(sudo /raspberry-remote/send 11000 1 1)”

the sendCommand applies only to Items defined in openHAB.
it works like: WDim01_Dim.sendCommand(100) (this will send the value 100 to the WDim01 item)

If you want to call a bash script from within a rule, you need to use the Exec binding or the executeCommandLine directive/action

1 Like

@Takrem

hava a look at the following post and please use code fences for better readability.