Switch set on time

This sounds a whole lot like you are trying to control a light based on a motion sensor. Have you looked at any of the motion sensor examples, such as Design Pattern: Motion Sensor Timer?

Ultimately you need to use a Timer.

var Timer timer = null

rule "Sw1 changed to ON"
when
    Item Sw1 changed
then
    // if the timer is not null we ignore the change in Sw1
    if(timer == null) {

        // The two switches have different states and since there isn't a Timer running we know that Sw1 
        // changed states which will cause Sw2 to change as well
        if(Sw1.state != Sw2.state) {

            // how long to set the timer for
            val time = if(Sw1.state == ON) 10 else 5

            // change Sw2's state to match Sw1's
            Sw2.sendCommand(Sw1.state)

            // create a timer to update Sw2 after the timeout if necessary
            timer = createTimer(now.plusMinutes(time), [|
                if(Sw1.state != Sw2.state) Sw2.sendCommand(Sw1.state)
                timer = null
            ])
        }
    }
end

I just typed in the above, something may be wrong.