Skip to content

Sunrise-Sunset Condition

The Sunrise/Sunset condition allows you to create a condition that is active (true) before or after sunrise or sunset, or between sunrise and sunset (or the reverse, for an overnight period).

A Sunrise/Sunset Condition

The operators ("before", "after", etc.) are the same for Sunrise/Sunset conditions as they are for Date/Time conditions.

The Sunrise/Sunset condition operands include offsets to the specified timing milestone. For example, one could specify that the condition is active from 30 minutes before sunset ("before sunset -30") to 30 minutes after sunrise ("after sunrise +30"). The offsets are in minutes, and may be positive, negative or zero.

Sunrise/Sunset conditions also have options for the use of civil, nautical, and astronomical dawn and dusk as well.

In latitudes sufficiently north or south, some event times cannot be computed because the sun's declination never meets the required angle. For example, in Leeds, UK in mid-summer, although the sun sets (goes below the horizon), it never exceeds the 18 degrees below the horizon required for astronomical dusk; and in Tromsø, Norway at that same time, the sun does not set (go below the horizon) at all. In these periods at those locations, the affected event times will be null. You should apply your local knowledge when selecting criteria for this condition, and account for the possiblity of a null value if necessary.

Configuration Required

Proper operation of the Sunrise/Sunset condition requires that your location (latitude/longitude) be correctly configured in reactor.yaml. You can check the configuration by requesting http://your-reactor-sys-ip:8111/diag/sun and confirm that the reported local date and time, timezone offset, location, and today's sunrise and sunset times are correct (they should be close to that reported by, +/- a couple of minutes). If your date/time or timezone offset are incorrect, you must configure your system clock correctly. If the sunrise/sunset times are wildly off, you likely have incorrect location data.

System Clock Dependency

If your logic relies on accurate time, please see make sure your Reactor host system is running an NTP or similar client to synchronize time to a reliable source. The built-in clocks on some systems can vary wildly over relatively short periods if not properly disciplined. Also make sure the host system's time zone is set correctly to your local time.

Updated: 2021-07-16