Why is time range with isBefore/isAfter not working!?

Hi all,

Im running in OH3.3 and have problems to get the following rule running:

rule "Eingangstuer"
	Item Tuer_Eingang received update
if(now.isBefore(now.withHour(5).withMinute(0)) && now.isAfter(now.withHour(7).withMinute(0)) ){
		timer = createTimer(now.toInstant().plusMillis(60000).atZone(now.zone)) [|
		timer = null
        rule_tuer.postUpdate( new DateTimeType() )

I can debug the rule to see that the trigger works fine but the if path is never accessed and hence the items below remain unchanged. Any ideas? I did not really find anything in the docs specifcally for this statement…

Thanks for any help!


I cannot think of any time that is both before 05:00 and after 07:00.

Did you mean after 5 and before 7?
Or, before 5 or after 7?

ah ok I see, logical mistake…
I removed the isBefore part but it is still not firing… is the isAfter command correct!?

Thanks for your support!

How can you tell? Why not add some logInfo() to see progress. Does the rule start? Does it pass the if()? Does the timer run?

Why not just