Commands cancel each other out?

What is likely happening is you are trying to send a new command over 433 before the last one is done being sent.

When you call executeCommandLine without a timeout, the call immediately returns and leaves the shell script running in a separate thread. So when you have multiple calls to executeCommandLine in a row without a timeout all three will likely be running at the same time. And since you are dealing with wireless and serial devices (presumably) the commands are stomping on each other.

At a minimum add a timeout to your executeCommandLine calls:

executeCommandLine("433-send xxxx 1 1", 5000)

That will cause executeCommandLine to wait until the script returns or five seconds, whichever comes first. However, I believe that this will not be an adequate solution in this case because you have more than one light connected over this 433 interface so it is not only possible but likely that two lights will be asked to turn on really close together.

I’m going to recommend adjusting your rules a bit to centralize your calls to sending the 433 messages into a single Rule. In that rule you can use a ReentrantLock and brief thread sleep to prevent messages from being sent too close together no matter which outlets are being commanded.

Items

String WirelessController

Rules

import java.util.concurrent.locks.ReentrantLock
var lock = new ReentrantLock

rule "433MHz Controller"
when
    Item WirelessController received command
then
    lock.lock // Ensures only one instance of the Rule can run at a time
    try {
        executeCommandLine(WirelessController.state.toString, 5000)
        Thread::sleep(100) // experiment to find the minimum sleep to obtain reliable switching
    }
    catch(Exception e) {
        logError("433", "Error handling 433MHz command: " + e)
    }
    finally {
        lock.unlock
    }
end

rule "Outlet A"
when
    Item outlet_a received command
then
    if(receivedCommand == ON){
        WirelessController.sendCommand(“433-send xxxxx 1 1”)
    }else{
        WirelessController.sendCommand(“433-send xxxxx 1 0”)
    }
end