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"
when
	Item Tuer_Eingang received update
then 
if(now.isBefore(now.withHour(5).withMinute(0)) && now.isAfter(now.withHour(7).withMinute(0)) ){
		timer = createTimer(now.toInstant().plusMillis(60000).atZone(now.zone)) [|
  		globalPresence.postUpdate(OFF) 
		timer = null
        rule_tuer.postUpdate( new DateTimeType() )
    ] 
}
end

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!

M.

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
now.plusSeconds(60)