Only do action only if item state is OPEN for 10 seconds

Thanks again Harry.

So the Script should be;

var Timer timer = null

rule "gMainDoors CLOSED"
when
    Item gMainDoors changed to CLOSED
then
    if(timer !== null) {
        timer.cancel()
        timer = null}
    NestTStat_away_mode.sendCommand("HOME")
end

rule "gMainDoors OPEN"
when
    Item gMainDoors changed to OPEN
then
    if(timer === null) {
        timer = createTimer(now.plusSeconds(10)) [|
            NestTStat_away_mode.sendCommand("AWAY")
            timer = null]}
    else
        {NestTStat_away_mode.sendCommand("HOME")}
end