Under Openhab 4.3 I was having trouble getting the astro:sun:night to trigger an END range event. Looking in my logs it seems this event doesn’t exist. So for others I thought I’d list what my log says is triggered and when. I use this in a rule to change an Item that keeps track of night and day (TLDR: use astro:sun:daylight START and END not astro:sun:night).
Starting at midnight the triggers and timings I saw were:
Time Channel Event
00:30, morningNight, START
Sun below horizon by 18°, morningNight, END
Sun below horizon by 18°, astroDawn, START
Sun below horizon by 12° , astroDawn, END
Sun below horizon by 12°, nauticDawn, START
Sun below horizon by 6°, nauticDawn, END
Sun below horizon by 6°, civilDawn, START
Sunrise, civilDawn, END
Sunrise, rise, START
Sunrise + a couple of mins, rise, END
Sunrise + a couple of mins, daylight, START
Sunset, daylight, END
Sunset, set, START
Sunset + a couple of mins, set, END
Sunset + a couple of mins, civilDusk, START
Sun below horizon by 6°, civilDusk, END
Sun below horizon by 6°, nauticDusk , START
Sun below horizon by 12°, nauticDusk, END
Sun below horizon by 12°, astroDusk, START
Sun below horizon by 18°, astroDusk, END
Sun below horizon by 18°, eveningNight, START
Sun below horizon by 18°, night, START
I use two of these range events (daylight START and END) as triggers in two rules to change the state of a String item (from NIGHT to DAY) which I can then use in a rule as a conditional comparison. This is used to control whether a presence sensor turns on a light or not. If the item is in a state “NIGHT” then the light is turned on otherwise the rule doesn’t run.