Rule / Switch not reliable

  1. Put all the Items into a Group. Let’s call it Devices. Add all the relevant Items to that one Group.

  2. Get clever with the naming of your Items. See Design Pattern: Encoding and Accessing Values in Rules. I’ll show putting the values into the Item name. So the Funksteckdose2Swith would be Funksteckdose2Switch_12345_12340.

  3. Trigger the Rule using the Member of trigger

  4. Pull the number to send out of the triggeringItem’s name.

val execscript = "/opt/433Utils/RPi_utils/Funksteckdose_1.sh "

rule "Devices"
when
    Member of Devices received command
then
    val parts = triggeringItem.name.split('_')
    val arg = if(receivedCommand == ON) parts.get(1) else parts.get(2)
    executeCommandLine(execscript + arg)
end

Those three lines and some clever naming of your Items will handle all your devices.