This page is part of archived documentation for openHAB 2.5. Go to the current stable version
# Astro Actions v1
With the Astro actions, you can calculate sunrise and sunset DataTime values in rules.
Important: The action also requires the installation of the corresponding Astro 1.x binding.
# Examples
import java.util.Date
rule "Astro Action Example"
when
...
then
var Date current = now.toDate
var double lat = xx.xxxxxx
var double lon = xx.xxxxxx
logInfo("sunRiseStart: ", new DateTimeType(getAstroSunriseStart(current, lat, lon)).toString)
logInfo("sunRiseEnd: ", new DateTimeType(getAstroSunriseEnd(current, lat, lon)).toString)
logInfo("sunSetStart: ", new DateTimeType(getAstroSunsetStart(current, lat, lon)).toString)
logInfo("sunSetEnd: ", new DateTimeType(getAstroSunsetEnd(current, lat, lon)).toString)
end
Caught a mistake or want to contribute to the documentation? Edit this page on GitHub (opens new window)