Rule to switch a light on one hour before sunset using the Astro Binding

I am new to OpenHAB, using version 4, and I would like to know, if possible, how I can turn a light on one hour before sunset.

The Astro Binding can give me the sunset time, but how can I create a rule that will trigger the action one hour before sunset.

That works with Channel triggers, you don’t need any Items:

Within MainUI, create an Astro Thing, configure a Channel for sunset with a Range Event, enter an Offset of -60 or whatever time before sunset you want, then trigger in your rules on

Channel 'astro:sun:yourChannelID:set#event' triggered START

As an alternative you may use the sun elevation linked with a switch item with range profile. In my case I use 5 degrees elevation to define night or day.

I use the same switch in several rules

1 Like

Thanks to both of you.
I had the basics, what I missed is that we can add on offset to the corresponding “Range Event”.
The first solution works, I waited this evening to test it. @moody_blue your idea sounds nice too, I will compare the results of both solutions.