CivilDusk Time Offset

OpenHAB Version 3.0.1

How do you set up a rule to turn on a light 30 minutes before CivilDusk, say? I am moving over from HomeSeer, and this seems like it should be simple to do. Although it seems easy to do it at CivilDusk, I can’t figure out how to add an offset using either the UI or the “Code” window like I see in some OpenHAB 2 examples in code. Suggestions?

Use the astro binding.

Configure the range event for sunset:

Then create an offset time for that event by using the configure channel.

Then create a rule to trigger at the event started for the set#event

Set the START or END of the event trigger otherwise the rule will fire twice (START and END)


If you wanted to use the range event for civil dusk you just do the same as above but instead of sunset event range you use the civil dusk event range.


Thank you, Greg. I hadn’t understood the concept of the range event. I’ve configured it and expect it will work fine this evening.

One question: The offset appears to apply to the range event for any rules which use it. For instance, if I have two rules and I want one to fire 30 minutes before sunset and one to fire 15 minutes after sunset, I wouldn’t be able to do that, since there is only one range event from astro:sun:local. I don’t suppose it’s possible to create a second instance of asto:sun:local or something?

Is my mental model accurate?

Thank you, again.

Yes, it is. call it notlocal, or plus30, or whatever.
You can apply offsets to the stuff you are interested in.
You can apply a different geographical location to shift every solar event.

Thank you!

Added an edit to the screenshots to add the START or END trigger otherwise the rule will run twice.