How to create a rule, which only executes some code, if a value does not change for a certain period of time

Hi,

I have a question about the Sample Rule in Github:

import org.openhab.model.script.actions.Timer
var Timer timer

rule "do something if item state is 0 for more than 10 seconds"
when
Item MyItem changed
then
if(MyItem.state==0) {
timer = createTimer(now.plusSeconds(10)) [|
// do something!
]
} else {
if(timer!=null) {
timer.cancel
timer = null
}
}
end

If I set the timer to 3600 seconds (1 hour), is OpenHAB able to run other rules or does the system just stay in this rule until the time is over?
Because I need to check if a value does not change over 1-2 hours and of course should perform other rules in this time.

Thank you in advance!

Yes.

Okay!
But one questions, how would I edit this rule to check if the value does not change for 2 hours.
This rule only works when the item state is 0 - but the state changes every 30 minutes to a different state. Where I have to put the variable?

createTimer(now.plusMinutes(120)) or
createTimer(now.plusHours(2))

1 Like