Rule "time between"

I´ve implemented a rule, which should enable alert, but in the night between 00:00 and 06:00 only.
Works fine, but alert was also activated at 07:30 and I don´t understand why.

Did I miss something? Kindly advise.

rule "Open door NIGHTalert"
when  Item Maindoor_Status changed
then
var Number hour = now.getHourOfDay
if ((hour >= 00)  || (hour <= 06)) {
	if (Maindoor_Status.state==OPEN) {
	if (Nightalert.state == ON) {
		sendCommand(Siren, ON)
		timer = createTimer(now.plusSeconds(1)) [|
		sendNotification("myemail@email.com", "ALERT!!!")]
	}
}
}
end

Simple, instead of || (or) use && (and).

As you said, you want your hours test to be between 00 AND 06, that’d be &&

Many thanks, guys!
It´s my first “between different times”-rule, so I was not sure about using “||” or “&&”.

BTW:
the following part of the rule is marked as “problematic” in the OpenHab designer with comment
"This expression is not allowed in this context, since it doesn´t cause any side effects"

sendNotification("myemail@email.com", "ALERT!!!")]

But the rule is working fine and I also get the notification. Any idea?

Hello,

I have made a similar rule using what I learned in this thread. It looks like this:

rule "Rolladen_Terrassentuer_Runter_wenn_Tuer_zugeht"
when  
 Item GF_LivingDining_Door changed to CLOSED
then
var Number hour = now.getHourOfDay
if ((hour >= 22) && (hour <= 06)) {
	GF_LivingDining_Middle_Shutter.sendCommand(DOWN)
}
end

The question is: will that work, since the first time in question is before midnight? Or do I need to use || (or):

if ((hour >= 22) || (hour <= 06))

Background: I have a rule that closes the roller shutter at 22:00, but only if the corresponding doorsensor is not open (so as to not shut anyone out of the house who exited through that door). I want the roller shutter to close when the door is then closed after the regular closing-time.

No, since hour cannot be both <6 AND >22 at the same time

This will be true between 22:00 in the evening and 06:00 in the morning i.e. overnight

Thanks.
I think I understand it now: var Number hour = now.getHourOfDay is (as someone more intelligent than me might have seen right away) a variable of the type number, and that number can be anything from 0 to 23. Nothing left of a time, which was confusing me.