Handover of valves (to avoid backdraft pressure)

Hi everyone,

I’m working on my irrigation system… I dont need to have all the fancy weather forecasts, rain sensors etc… as where I live its always dry… (it rains 3 days per year)

So, I’m trying to open 1 valve after another… in short, each valve opens for 3 minutes (as per the items file), but I want the next valve to open 1 second before the prior valve closes.

rule "Sprinkler demand / on"
when 
    Time cron "0 0 07 ? * * *" or
    Channel 'velbus:vmbgp2-2:961ea6934d:14:input#CH1' triggered PRESSED
then
     logInfo("IRRIGATION","IRRIGATION SEQUENCE STARTED")
     WATERING=true
        logInfo("IRRIGATION", "Valve 1: " + Sprinkler_Switch1_TIMER_3m_OFF.state)
        logInfo("IRRIGATION", "Valve 2: " + Sprinkler_Switch2_TIMER_3m_OFF.state)
        logInfo("IRRIGATION", "Valve 3: " + Sprinkler_Switch3_TIMER_3m_OFF.state)
        logInfo("IRRIGATION", "==========")

// first valve to open and start pump
        Sprinkler_Switch1_TIMER_3m_OFF.sendCommand(ON)
        sendCommand(Sprinkler_Switch0, ON)  //PUMP

// open valve 2, close valve 1 (as built-in timer seems to not work anymore for closing valve 1)
        valve2runtimer = createTimer(now.plusSeconds(179)) [ |
            Sprinkler_Switch2_TIMER_3m_OFF.sendCommand(ON)
            Sprinkler_Switch1_TIMER_3m_OFF.sendCommand(OFF)
        ]
// open valve 3 after valve 2
        valve3runtimer= createTimer(now.plusSeconds(359)) [ |
            Sprinkler_Switch3_TIMER_3m_OFF.sendCommand(ON)
            Sprinkler_Switch2_TIMER_3m_OFF.sendCommand(OFF)
            WATERING=false
        ]

// switchoff pump before closing last valve - to release pressure
        pumptimer= createTimer(now.plusSeconds(539)) [ |
            sendCommand(Sprinkler_Switch0, OFF)
        ]
end

however the above code does not yet do what I want…

whats the best way to fix this?

Does this snippet come from a file or UI based rule? It has a bearing on how mystery variable nextvalve behaves.

What does items file have to do with it, is there some expire feature not disclosed?

apologies - pasted the latest code i have now… - its an .rules file

What does it do instead? Your events.log should provide a timestamped trail.
There’s a lot of undefined variables there, are you creating those as globals elsewhere? If that is the problem, your openhab.log will be telling you about it.

There is no 1-second overlap yet, but that’s easily added after you get the basic structure right.