Wait until a certain hour after event triggered

Dear all,
I am trying solve the following problem:
After dawn (using the Astro Binding), I want to close my rollershutters ONLY if it is after 6 pm. If it is before 6pm, I want to wait until 6pm and then close the rollershutters.

I do NOT want to use the earlierst/latest configuration of the Astro binding because I want to state the logic explicit in the rules instead of “hiding it away” in some configuration. And I want/need to practice my rule coding skills. :wink:

This is what I have done so far and it is working fine:

rule "Shutter Evening"
when
    Channel 'astro:sun:local:set#event' triggered END
then
         gRolShutters.sendCommand(DOWN)         
end

Could someone point me to a solution for this?

Thanks and regards

Torsten

Use a rule that triggers at 6 pm (using cron) and close the rollershutter only if dawn has happened and another rule that triggers at dawn and close the rollershutter only if the actual time is after 6 pm.
Such behaviour has been build into the binding, but you don’t want it…

Thank you Jürgen,

I implemented the following using a helper variable to keep track of the daylight status. I hope it will work.

Torsten

var boolean sundown = false

rule "Shutter Evening Astro"
when
    Channel 'astro:sun:local:set#event' triggered END
then
	sundown = true
	if (now.getHourOfDay() >= 18){
		logInfo("Shutter Evening Astro", "sundown true & >= 6pm")
		gRolShutters.sendCommand(DOWN)
                sundown = false
	}
	else{
		logInfo("Shutter Evening Astro", "sundown false & < 6pm") 
	}
end

rule "Shutter Evening Cron"
when
	Time cron "0 0 1 18 * ? *"
then
	if (sundown == true) {
		logInfo("Shutter Evening Cron", " After 6pm  & sundown true") 
		gRolShutter.sendCommand(DOWN)
                sundown = false
	}
	else{
		logInfo("Shutter Evening Cron", " Before 6pm & sundown false") 		
	} 
end